ASP.NET Core unit tests
In this section, we’ll learn how to build an ASP.NET Core unit test project using xUnit.net, a free, open-source, community-focused unit testing tool for .NET created by Brad Wilson, who also developed NUnit v2. We’ve chosen this tool because it’s arguably one of the most powerful and easy-to-use unit testing tools available today. It’s part of the .NET Foundation, hence operating under their code of conduct, and is licensed under the Apache License, version 2.
Before moving on, we’ll also take the opportunity to talk about TDD and BDD in the following sections. These are two widely used testing approaches that have a number of similarities and differences that are worth exploring.
Creating the WorldCitiesAPI.Tests project
The first thing to do is to add a third project to our WorldCities
solution, which currently hosts the WorldCities
Angular app and the WorldCitiesAPI
ASP.NET Core Web API.
If you created...