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 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.