-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
ASP.NET Core 9 Web API Cookbook
By :
xUnit makes it easy to unit test the individual discrete pieces of our application. In this first recipe, we will focus solely on xUnit’s built-in functionality – which is quite powerful on its own – before introducing the additional testing libraries: AutoFixture, NSubstitute, and FluentAssertions. This approach helps us appreciate what xUnit can do on its own before adding more specialized tools.
Clone the starter project here: https://github.com/PacktPublishing/ASP.NET-9-Web-API-Cookbook/tree/main/start/chapter07/UnitTests1.
The starter project includes a simple web API that uses Entity Framework Core (EF Core). Although it uses EF Core, there is also a separate repository layer. We will focus on testing the service layer and mocking the repository layer for this series of unit tests.