Chapter 11
Introducing Test Doubles

You can fool some of the people all of the time and all of the people some of the time, but you cannot fool all of the people all of the time.

Abraham Lincoln

So far, we have developed and written tests for self-contained code, which is code without dependencies. These are, and have always been, the easier parts of any system development, the easily sharable parts, and the reusable parts. A more formidable challenge for TDD is testing code in the middle, which consists of the modules that must work through other modules, functions, and data stores to get their job done. This part of the book is dedicated to demonstrating techniques to effectively test the code in the middle.