Mocking OpenAccessContext for Unit Testing Repositories...

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    1 posts
    Member since:
    Aug 2012

    Posted 22 Jul 2013 Link to this post

    I am trying to create a mock object for the context. I have a class that extends OpenAccessContext that is my specific context for this part of my project. I then built a repository on top of that which contains custom logic for how to save, create and delete objects using the context. The context is injected into the constructor using Windsor Castle. I now want to write unit tests that pass in a mock context to the repository for testing but I cannot do that with the Mocking Framework I am using (Rhino.Mocks). I am not sure how to go about testing the repository as my unit tests cannot rely on a connection to the database. Please help.
  2. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 23 Jul 2013 Link to this post

    Hi Daniel,

    You could download the Samples Kit and have a look at the Ajax With Data Annotations sample. It demonstrates exactly this setup.

    Hope that helps.

    Damyan Bogoev
    OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
  3. DevCraft banner
Back to Top