This is the second in a series of articles covering the
Rhino Mocks mock object framework for the .NET Framework. The aim of this
series is to provide you with an understanding of how mock objects are used,
how they can improve the quality of your unit tests and how mock objects can
make the difficult to test sections of your application simpler to test.
In this second part, I cover when mock objects might be
useful and explain how to implement the common uses of mock objects in your
unit tests. I discuss how to mock your data layer, which involves
accessing both a database and a web service, when testing your business layer
and how to actually implement the data layer keeping it both flexible and
mockable.
If you do not have experience with mock frameworks and have
not read the first part, then I recommend you read that first before coming
back to this article.