What are Microsoft Fakes in Visual Studio 2012 Ultimate?
Posted: (EET/GMT+2)
Unless you are testing trivial code with unit tests, you quickly run into situations where you will need to fake some functionality with another class or component. In Visual Studio 2012, Microsoft has again ramped up the functionality in its own unit testing framework called "Microsoft Unit Test Framework for Managed Code".
The new Microsoft Fakes is an extension to the functionality of the test framework, and provides both stubs and shims to help you in writing your unit tests. The Fakes support is available in Visual Studio 2012 Ultimate only.
A good introduction on how to use the Fakes support is available on MSDN. For one part, the support can automatically create fake interfaces for all interfaces in your Visual Studio project. Then, you can find these created interfaces with the "Fakes.Stub" prefix. Alternatively, you can find shims from the System.Fakes namespace.