I am working on an ASP.net MVC 3.0 Application. I am using MSTest
along with Moq
for unit testing. I have written all the test methods for my contr
A controller never should call the database directly (one - not the most important - reason for that is that this makes the controller almost impossible to test...). Instead, I strongly advise you to refactor your code to enable testability in the first place and also to have proper Separation of Concerns: Put all your data access code into Repositories which you then access in your controllers via interfaces. This way, you can easiliy mock them with Moq.