O'Reilly logo

Refactoring with Microsoft Visual Studio 2010 by Peter Ritchie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mocking frameworks

As we've seen so far, we've manually created test doubles in order to isolate the system under test. There are frameworks collectively called "Mocking Frameworks" that facilitate automatic creation of Stubs, Fakes, Mocks, and Dummies. We have a cursory look at a common subset of those frameworks now.

Rhino Mocks

Rhino Mocks is an open source mocking framework written by Ayende Rahien. To use Rhino Mocks with your test project, simply add a reference to Rhino.Mocks.dll.

[TestClass] public class InvoiceRepositoryTest { /// <summary> /// Creates canned invoice data /// </summary> /// <param name="invoiceId"></param> /// <param name="constantDate"></param> /// <returns>DataSet of invoice data</returns> private DataSet CreateInvoiceDataSet(Guid ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required