Chapter 3. TDD and Refactoring

A good example is a powerful thing; I think we are in agreement on that. One way to describe Test-Driven Development (TDD) is to say that you use tests or examples for specifying the behavior. Those examples will serve you over and over again for many different purposes. They will serve you during development, for example, for finding lacking or incorrect requirements. When you refactor, the tests will be a safety net. After development they will serve you as quality documentation.

In this chapter we will not just talk about tests as examples; we will discuss TDD itself with some examples. I just think that’s a good way of describing what it’s all about.

After some initial discussion of TDD and the state-based ...

Get Applying Domain-Driven Design and Patterns: With Examples in C# and .NET now with the O’Reilly learning platform.

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