This is a migrated thread and some comments may be shown as answers.

Mocking OpenAccessContext for Unit Testing Repositories...

1 Answer 79 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Daniel
Top achievements
Rank 1
Daniel asked on 22 Jul 2013, 06:43 PM
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.

1 Answer, 1 is accepted

Sort by
0
Damyan Bogoev
Telerik team
answered on 23 Jul 2013, 10:19 AM
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.

Regards,
Damyan Bogoev
Telerik
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.
Tags
Development (API, general questions)
Asked by
Daniel
Top achievements
Rank 1
Answers by
Damyan Bogoev
Telerik team
Share this question
or