NMock is a dynamic mock object library for .NET. Mock objects make it easier to test single components—often single classes—without relying on real implementations of all of the other components. This means we can test just one class, rather than a whole tree of objects, and can pinpoint bugs much more clearly. Mock objects are often used during Test Driven Development.

NMock 2.0 Release Candidate 2 is now available! The original NMock was a .NET port of the Java-based DynaMock, whereas NMock 2.0 is inspired by the newer jMock library. Expectations are defined using a much more “conversational” style, including plenty of syntactic sugar to improve clarity.

A dynamic mock object:

Features specific to NMock:

The best way to see how NMock works is to read the Quickstart (5 minutes) or the Tutorial (15 minutes). Developers who already have experience with mock objects will find everything they need to know on the Cheat Sheet.

ThoughtWorks     SourceForge