Wednesday, August 25, 2004

NMock : A Dynamic Mock Object Library for .NET

Richard Hundhausen just sent me a link for this: NMock : A Dynamic Mock Object Library for .NET.

From what I can tell, NMock could be useful when you have a large group of programmers and someone else is developing a class that you need to develop against. You implement the interface of that unknown class in NMock. Then you develop your implementation against that mock implementation. You can then test to verify that your code all behaves correctly.

This could also be useful if you are implementing a facade class for some data access class. Then you can create a test without worrying about what is in the database or the state of the database. Your mock of the data access class always returns known values so you can create reproducible tests (with NUnit of course).

Or say maybe you have a really expensive to deploy (in $$ or impact to the machine) 3rd party library. You create a mock implementation and all your developers can develop using NMock and not need to worry about the actual library.

No comments: