Code Contracts and Pex: Power Charge Your Assertions and Unit Tests

Play Code Contracts and Pex: Power Charge Your Assertions and Unit Tests
Sign in to queue


By Nikolai Tillmann and  Mike Barnett

Learn how Code Contracts provides a set of tools for design-by-contract programming and how Pex is an advanced unit-testing tool that uses automated program exploration to intelligently create unit tests with high code coverage. 
See how they work together so that your code has fewer defects.

Learn about new features for Code Contracts including automatic documentation generation, call-site checking for components and reference assemblies for the .NET Framework and for Pex including a light-weight mocking framework, improved support for large code bases, and more thorough test input generation.

PEX // Code Contracts // Mike Barnett // Nikolai Tillmann // MDCC // DPE DK



Right click to download this episode

The Discussion

  • User profile image

    Near the end now and I really need to ask:

    Witch one is nicer in your opinion ?

    1. MDataTime.NowGet() = () => DateTime.Now;

    2. Isolate.WhenCalled(()=> DareTime.Now()).WillReturn(DateTime.Now);


    And you know what's great, WillReturn can have a delegate also, but it does not have too all the time.

  • User profile image

    > Witch one is nicer in your opinion ?

    Let's say that both are not as good as they could be. Language/CLR support would be the ultimate solution.


    ps: 1. will result in a stackoverflow since the delegate will recursively call itself. Not sure about 2.

Add Your 2 Cents