[RESOLVED]Moq with MVC 5

Hi guys,

I am using Asp.net MVC 5.

I have done with sample unit testing and repository pattern with Entity framework 6 in MVC 5.
And now I am looking for using unit testing with moq (Mock) object tutorial.
is there any turtorial’s link to learn about using moq with MVC 5?

You don’t "use moq with mvc5", you use moq to unit test your controllers (or any other classes you might want to test).  The fact that classes are controllers or any other class is irrelevant to unit testing or to moq.  Just read up on examples of how to
use moq in general and it should all become clear.  The second post on this thread


shows the basics of mocking a controller using moq.

If that’s not enough I googled "using moq with mvc" and here are some results



This is a great question as it’s very important! I wrote up a detailed, step by step guide to using Moq with ASP.NET MVC here:


If you have any questions let me know!

Leave a Reply