Book Image

Visual Studio 2013 and .NET 4.5 Expert Cookbook

Book Image

Visual Studio 2013 and .NET 4.5 Expert Cookbook

Overview of this book

Table of Contents (14 chapters)
Visual Studio 2013 and .NET 4.5 Expert Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with the Microsoft Fakes framework in Visual Studio


Isolation of the dependencies in code by mocking or faking objects is one of the common norms when developing unit tests or creating a Test-driven development. People write mocking objects that can be used to redirect calls to some dependent objects in order to independently test modules. There are also a number of frameworks that generate mocking objects automatically based on the existing dependencies without having to use any handwritten objects. The Visual Studio 2013 Ultimate edition comes with a new Microsoft Fakes framework that takes mocking to a new level.

If you have used Microsoft Moles before, you will find that the Fakes framework has a very similar workflow. Moles was originally designed for Microsoft Pex, which is another great unit testing tool by Microsoft Research. Moles became popular because it could virtually create mocks on anything and was so simple that there was hardly any overhead on using it. Moles provided...