Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mocking framework from Microsoft?

I want to start using mock objects on my c# project.

After a quick google I've found that most folks use one of the below:

  • NMock
  • EasyMock.Net
  • TypeMock Isolator
  • Rhino Mocks
  • Moq

Does Microsoft provide a similar framework for mocking? I'm using Visual Studio tests for my unit test now.

like image 282
Nevin Mathai Avatar asked Jan 03 '10 01:01

Nevin Mathai


1 Answers

Microsoft does not have any official public mock object frameworks. We do have some internal ones that we've used before (I work at Microsoft). In recent times we have prefered to use publicly available libraries because we give out the source code to both the projects and unit tests of many of our projects and we'd like the public (that's you!) to be able to compile and run these projects.

On my team (ASP.NET) we now most often use Moq. The author (kzu) is very receptive to our feedback and bug reports.

To see an example of how we use Moq, you can download the source code to ASP.NET MVC 2 Release Candidate, which includes both the project source code and over 2,000 unit tests.

like image 199
Eilon Avatar answered Sep 28 '22 22:09

Eilon