WHAT'S IN THIS CHAPTER?
Unit testing (UT) is the cornerstone of test-driven development (TDD). When your unit tests are properly aligned with and correctly reflect your business requirements, they almost become a living design document — one that can validate the code you've written with the push of a button. Unit tests are not difficult to write, although they do require a minor change to how you usually approach writing software. They also represent a few new concepts to master, such as code isolation and the idea of having stand-in or mock objects to enable your tests to focus on only the code that is being tested. These new concepts are integral to TDD. The ability to write isolated, repeatable, and focused tests allows you to ensure that your code is meeting the business's needs and can continue to evolve without those changes disrupting the code's fidelity to the business's needs. To help you with these concepts, tools and frameworks such as NUnit and Moq can make your development process easier, faster, and more rewarding.