I am new to mvc3 .Can anyone please tell me how to create unit test project ?my solution i am using dependency injection priniciple then how to test my methods.please give me any sample links to acheive that?
Asked
Active
Viewed 87 times
0
-
Take a look on [this answer with test sample](http://stackoverflow.com/a/20513150/470005) – Sergey Berezovskiy Jan 02 '14 at 12:49
1 Answers
0
You can use Repository pattern (and Service layer) so that you can mock/stub all your database/service layer calls in your tests and inject the dependency. You can use it without the Service layer if you want but would suggest to go with it so that any business logic you have after getting data from DB using Repository can reside in that layer.
http://msdn.microsoft.com/en-us/magazine/dd942838.aspx#id0420033

Adarsh Shah
- 6,755
- 2
- 25
- 39