Archive for tag unit testing

A Guide to Unit Testing with Microsoft Fakes

When choosing mocking framework for your unit tests, you may find quite many options: Moq, Rhino Mocks, NMock, EasyMock.NET, etc. All of them have the similar functionality and are open source.

However, if you or your client prefer commercial products, (e.g. due to better support and guarantees), there is one framework that deserves your interest. It’s Microsoft Fakes. It is available with Visual Studio Premium or Ultimate (starting with 2012). The distinguishing feature of this framework is replacement of calls to assemblies that you cannot modify. For instance you can mock System.DateTime.UtcNow of System.dll, which isn’t possible with other mocking frameworks.

In this post I’ll tell how you can use this framework to simplify mocking external modules in your unit tests.

read more