dimanche 31 mai 2015

What is the best way to write unit test cases for repository methods in an ASP.NET WEB API project?

We are working on a project where ASP.NET web api is used on the server side and angular js is used on client side.

Web API project is designed to use entity framework with repository pattern for data access.

Now I have to start writing unit test cases on all the controller methods. One way I am thinking of achieving this is to mock repository and test remaining part of controller. That looked reasonable but I strongly feel writing unit test cases on the repository methods is also as important as the other. I can't think of any idea how I can write unit test cases on repository methods. I remember to have worked with sqllite by creating in memory database instance to achieve the same couple of years back. Is that way go forward or is there something we can do with less effort.

Any guidance or thoughts ?

Aucun commentaire:

Enregistrer un commentaire