In this course you will learn how to use the Microsoft Fakes provided with Visual Studio 2012 to isolate your tests from the dependencies of the classes you are unit testing. It will teach you how to use stubs to track dependency collaboration and to control program flow. It will also teach you how to use shims to test legacy code.
Donald Belcham is a senior software developer, independent contractor, and agile development expert who is a strong supporter of fundamental OO patterns and practices. Since 2007, he has been awarded the Microsoft MVP Award in C# and is a member of the JetBrains Academy.
Microsoft Fakes Fundamentals Hi. My name is Jim Cooper and welcome to this Pluralsight course on the Microsoft Fakes Fundamentals. In this course I'll be showing you how to use Microsoft Fakes to simplify your unit tests. We'll first briefly about the challenges of unit testing and the properties of a good unit test and I'll talk about how unit tests can be complicated when the code we are testing has dependencies on other classes and how replacing these dependencies with test doubles when unit testing can simplify your tests and make it easy to create unit tests that adhere to the properties of a good unit test. Then in the module on hand rolled mocks Donald Belcham will show us how we could write our test doubles ourselves if we're not going to use a mocking framework like Rhino mocks. Although I don't recommend hand rolling your own mocks it will help us to understand that types of things that Microsoft Fakes frameworks is doing for us behind the scenes. I'll then show you an example of a poor quality unit test and how to fix that test using Microsoft Stubs and while I show you the stubs I'm going to point out some important differences between the Microsoft Face frameworks and other mocking frameworks like Rhino mocks or mock. These are differences that I think are really important to be aware of before choosing a mocking framework. I'll then talk about the challenge of controlling program flow within your unit tests and how Microsoft Stubs can help us with that. And finally, I'll conclude about talking about Shims, what they were intended for and what they were not intended for and how you can use them to create tests around legacy code.
Using Stubs to Improve a Unit Test Hello everyone. This is Jim Cooper and I'll be taking you through this Microsoft Fakes Framework module on using stubs to improve your unit tests.
Using Stubs to Control Program Flow Hi this is Jim Cooper. Welcome to this Pluralsight module. I'm using the Microsoft fakes framework Stubs to control program flow.
Using Shims to Test Legacy Code Hi! This is Jim Cooper and welcome to this Microsoft Fakes Framework Module on Using Shims to Test Legacy Code.
Summary So in summary, you've learned about the properties of a good unit test, how test doubles can simplify our unit tests, and you've seen how to use Microsoft Fakes stubs to improve unit tests and to control program flow, and, finally, how to use shims to test legacy code. I hope you've enjoyed this course on Microsoft Fakes fundamentals.