Chapter 5. Isolation (mock object) frameworks

This chapter covers

  • Understanding isolation frameworks
  • Defining fake objects
  • Using Rhino Mocks to create stubs and mocks
  • Surveying advanced use cases for mocks and stubs
  • Exploring arrange-act-assert and record-and-replay syntax
  • Avoiding common misuses of isolation frameworks

In the previous chapter, we looked at writing mocks and stubs manually and saw the challenges involved. In this chapter, we’ll look at some elegant solutions for these problems in the form of a mock object framework—a reusable library that can create and configure stub and mock objects at runtime. These objects are usually referred to as dynamic stubs and dynamic mocks.

We’ll start this chapter off with an overview of mock ...

Get The Art of Unit Testing: with Examples in .NET now with O’Reilly online learning.

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