Tuesday, May 8, 2012

Testing the Untestable with VS2012 Fakes

One of the new features included with Visual Studio 2012 is the Fakes Framework which offers the ability to detour code at runtime and isolate functionality for true unit testing, regardless of whether the code was written with testing in mind.

I began speaking on Fakes back when it was a beta product from Microsoft Research called Moles. While the core functionality remains the same, Microsoft has streamlined the implementation and now calls the detour mechanism a shim rather than a mole.

If you have attended this or another of my talks at a user group or conference, please take a moment to share your feedback on SpeakerRate.

The PowerPoint is available on SlideShare and below are links to the code demonstrated in the presentation.

Demos
Y2K Checker (simple introduction)
DateTime Audit (avoiding non-deterministic tests)
File Reader (shimming file system access)
Repository (stubbing interfaces)

Resources
Visual Studio 2011
Fakes MSDN Documentation

1 comments:

  1. I had a look to your presentation, it was nice to have a complete overview on unit testing. Simple explanation on delegates, stubs, interfaces and shims but still useful to me being in the software development field. .

    ReplyDelete