Creating the Better Unit Testing with Microsoft Fakes eBook.

In August last year we kicked off an initiative to create some value-add guidance on Microsoft Fakes for the ALM community. Last week, we shipped our eBook – Better Unit Testing with Microsoft Fakes.

Once an ALM Rangers project gets signoff it needs to pass a final hurdle before getting the green-light to proceed. This involves presenting the project’s Vision, Epics, Delivery Artefacts, Milestones etc… and then hoping that fellow ALM Rangers will offer to join the project.

We had a phenomenal response and by late September a team of 14 or so members were up and running. This number of people was contrary to our plan to reduce teams to max 5 members, but we had a good mix of reviewers / contributors and a backlog where we could tackle two epics at once — again breaking some of our rules (sorry Willy/Brian!) — so I felt that the team could operate effectively and deliver on time.

Using Lync we had a weekly stand-up where we could all say good morning/afternoon/evening from our little spaces over the planet we call home or work (or perhaps on a mobile on the side of a freeway). Overall this was pretty successful and attendance was great. This, coupled with emails and Skype ensured we maintained a suitable momentum. I’ll be honest, we had a few hiccups where our burn down was not exactly going down, but we managed to re-evaluate and re-group as necessary to ensure that our final delivery met the expectations of our product owner and indeed our own vision; and on schedule. If you’re wondering, all our code and docs live in the cloud on the Team Foundation Service.

We worked through monthly sprints and delivered two internal BETAs, and then our RTM guide. Like many projects, we managed to get a large portion of our content nailed down fairly quickly, then getting that polished and the final content added took a whole bunch of effort. Here are a few fun facts from the project…


We hit various challenges in the project from bugs in our new documentation templates, bugs in Fakes, changes to Visual Studio (Update 1 and 2), day job and family pressures; but we’re all proud to have delivered the ALM Rangers first eBook and on a subject that just got a whole broader audience now that Microsoft Fakes will be included in Visual Studio Premium with Update 2.

Thanks to all those involved in making this a reality – Brian Blackman, Carsten Duellmann, Dan Marzolini, Darren Rich, David V. Corbin, Hamid Shahid, Hosam Kamel, Jakob Ehn, Joshua Weber, Mehmet Aras, Patricia Wagner, Peter Provost, Richard Albrecht, Richard Fennell, Rob Jarratt, Shawn Cicoria, Waldyr Felix, Willy-Peter Schaub

I encourage you to download the guide and see what Microsoft Fakes is all about.

Here’s a brief outline of what you will find in V1.



Chapter 1: A Brief Theory of Unit Testing

  • Software testing
  • The fine line between good and flawed unit testing

Chapter 2: Introducing Microsoft Fakes

  • Stubs
  • Shims
  • Choosing between a stub and a shim

Chapter 3: Migrating to Microsoft Fakes

  • Migrating from Moles to Microsoft Fakes
  • Migrating from commercial and open source frameworks

Chapter 4: Miscellaneous Topics

  • Targeting Microsoft .NET Framework 4
  • Adopting Microsoft Fakes in a team
  • You can’t Fake everything!
  • Verbose logging
  • Working with strong named assemblies
  • Optimizing the generation of Fakes
  • Looking under the covers
  • Refactoring code under test
  • Removing Fakes from a project
  • Using Fakes with Team Foundation Version Control
  • Using Microsoft Fakes with ASP.NET MVC

Chapter 5: Advanced Techniques

  • Dealing with Windows Communication Foundation (WCF) service boundaries
  • Dealing with non-deterministic calculations
  • Gathering use-case and other analytical information
  • Analyzing internal state
  • Avoiding duplication of testing structures

Chapter 6: Hands-on Lab

  • Exercise 1: Using Stubs to isolate database access (20 – 30 min)
  • Exercise 2: Using Shims to isolate from file system and date (20 – 30 min)
  • Exercise 3: Using Microsoft Fakes with SharePoint (20 – 30 min)
  • Exercise 4: Bringing a complex codebase under test (20 – 30 min)

In Conclusion



5 Replies to “Creating the Better Unit Testing with Microsoft Fakes eBook.”

  1. Pingback: Shawn Cicoria

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s