Integration testing in ASP.NET Core is really easy thanks to the Microsoft.AspNetCore.Mvc.Testing package. (Check out my previous post about this).
Reference the startup file, inject the WebApplicationFactory<TStartup> in your test class and you are good to go. This will create an in memory test server that can be invoked directly.
While using this approach I stumbled over a problem. The startup file was not using the configuration I had specified in the appsettings.json???
To make a long story short, it turns out that the startup file will use the appsettings.json file as available in the API project not in your test project.
So if you need to apply specific configuration settings for your test scenario’s, you have to make this changes to the appsettings.json (or appsettings.<environment>.json) in your API project.