Getting Started with Unit Testing
Unit testing is the core of TDD and a prerequisite for practicing it. I want to briefly go through the minimal necessary theory and focus more instead on familiarizing you with the tools and techniques that unit testing practitioners utilize in their daily code.
Here, you will learn how to write unit tests that cover moderate coding scenarios. In Part 2, Building an Application with TDD, of this book, we will take the knowledge acquired in this chapter to a higher level and use it in a lifelike fashion.
In the previous chapter, we built the weather forecasting application (WFA) and made it a dependency injection (DI)-ready. We will use this application in this chapter as the basis for learning about unit testing. If you are not familiar with DI and DI containers, I recommend starting with Chapter 2, Understanding Dependency Injection by Example, first.
In this chapter, we will do the following:
- Introduce unit testing
- Explain the...