Integration tests verify that an application's components work together correctly and that business logic returns expected values. WebApplicationFactory spins up the actual host in-process during tests, providing a real HTTP client connected to it — no mocking required.
Start with the default WebApi template — this example uses the weather forecast controller generated by Visual Studio:

Create an NUnit test project and install the Microsoft.AspNetCore.Mvc.Testing NuGet package:

Create a WebApplicationFactory subclass in the test project — this starts the API host and exposes an HttpClient connected to it:

Use the factory's client to make real HTTP calls against the running API:

