Integration tests ensure that an app’s components function correctly, that the business logic returns the expected value. WebApplicationFactory is not new in the dotnet world but it’s not well know to all dot net developers.
A more comprehensive article can be found at https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-3.1.
In this example I will exemplify a simple webapi and one method test with NUnit.
The web api example is the one generated as a template when creating a new WebApi solution
Create a unit test project (NUnit, C#, dotnetcore) and install the Microsoft.AspNetCore.Mvc.Testing package
In our unit test project we will create the WebApplicationFactory which will start the host to our api and provide a client to connect to
Now we can use the client to make an http call