Unit testing functions
Fixing bugs in code is expensive. The earlier that a bug is discovered in the development process, the less expensive it will be to fix.
Unit testing is a good way to find bugs early in the development process. Some developers even follow the principle that programmers should create unit tests before they write code, and this is called Test-Driven Development (TDD).
More Information: You can learn more about TDD at the following link: https://en.wikipedia.org/wiki/Test-driven_development
Microsoft has a proprietary unit testing framework known as MS Test; however, we will use the free and open source third-party framework xUnit.net.
Creating a class library that needs testing
First, we will create a function that needs testing. We will create it in a class library project. A class library is a package of code that can be distributed and referenced by other .NET applications:
- Inside the
Chapter04
folder, create two subfolders...