A.1. Isolation frameworks

Mock or isolation frameworks are the bread and butter of advanced unit testing scenarios. There are many to choose from, and that’s a great thing:

  • Moq
  • Rhino Mocks
  • Typemock Isolator
  • JustMock
  • Moles/Microsoft Fakes
  • NSubstitute
  • FakeItEasy
  • Foq

The previous edition of this book contained the following tools, which I’ve removed due to being out of date or relevance:

  • NMock
  • NUnit.Mocks

Here’s a short description of each framework.

A.1.1. Moq

Moq is an open source isolation framework and has an API that tries to be both simple to learn and easy to use. The API was one of the first to follow the arrange-act-assert style (as opposed to the record-and-replay model in older frameworks) and relies heavily on .NET 3.5 and 4 features, ...

Get The Art of Unit Testing, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.