Unit Testing with Microsoft Fakes

Download this episode

Download Video

Download captions

Download Captions

Description

In this episode, Robert is joined by Carsten Duellmann and Ricardo Wickel, who show us how to improve our unit test using Microsoft Fakes. Fakes help you isolate the code you are testing by replacing other parts of the application with stubs or shims. These are small pieces of code that are under the control of your tests. By isolating your code for testing, you know that if the test fails, the cause is there and not somewhere else. Stubs and shims also let you test your code even if other parts of your application are not working yet.

 

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image
      dudumanbogd​anvlad

      Great topic! I have learned something new today. Glad that I have recently followed @ch9 on twitter. 

    • User profile image
      nektar

      The bad thing is that unlike in all other programming frameworks such as Java, JavaScript, Objective C, Python, you name it, this functionality is provided for free or can be easily achieved. For .NET you have to buy Visual Studio Primium Edition and above. I think that requiring me to pay so much for this feature is problematic because unit testing with mocks is such an essential need in today's software development.

    • User profile image
      Duncanma

      @nektar: to be fair, you can build fakes and mocks in any version of Visual Studio, this is just an easier way to do it, a framework to make it easier. Understand that you'd like to have it for free, but I don't want other readers to think that doing unit testing with mocks is impossible outside of VS Ultimate. Channel 9 uses fakes in our unit tests, and we don't use any framework for this outside of dependency injection. Other frameworks do exist as well that have no VS-version requirement (such as http://hibernatingrhinos.com/oss/rhino-mocks)

    • User profile image
      pajocomo

      Using Thread.Sleep mixed with Tasks and specially using Thread.Sleep for waiting for a task to end show you need to learn a lot about Tasks and TAP.

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.