-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
ASP.NET Core 9 Web API Cookbook
By :
In this recipe, we will set up unit testing on the Controller layer. We will explore the expanded version of the FluentAssertions library, FluentAssertions.AspNetCore.Mvc, which will allow us to assert against HTTP results and not only internal method logic. We will provide dependencies to the controller via AutoNSubstitute. Also, we will create a custom fixture to provide a consistent environment for our controller tests.
The starter project for this recipe can be found here: https://github.com/PacktPublishing/ASP.NET-9-Web-API-Cookbook/tree/main/start/chapter07/UnitTestsController.
You can also continue from the preceding recipe.
FluentAssertions package for testing the controller’s action methods. Make sure you add this only in the Unit.Tests project.Important note
FluentAssertions.AspNetCore.Mvc cannot coexist with the standard...