I want to start using mock objects on my c# project.
After a quick google I've found that m开发者_如何学运维ost 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.
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.
In Visual Studio Ultimate and Premium version, there is:
Microsoft Fakes Framework
精彩评论