Introduction to Pex Stubs

July 5, 2009 20:17

This post is a walk-through for using Stubs, an interesting approach to mocking from Microsoft Research[1].

Typically, while mocking something you set up expectations via expression trees or string based APIs. The framework would then, at runtime, dynamically generate the code you need.


Stubs guys took a different route: they generate the code statically. Right click on the method you want to test, click a button and a separate project with the stubs you need gets created. Just go and use them.

The Shark Fin: Pex

April 26, 2009 10:02
Imagine: you have a method that needs to be tested.

You right click on it, select "Generate Tests" and a tool generates a suite of tests that cover all code paths. If you later update the original method, you just need to regenerate the tests and the missing coverage is back.

Given that you are still reading,  I will assume that you're ready to take the red pill.