-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Hi there 👋
I'm trying to do a basic integration test for a very simple ASP.NET Core WebApi project.
I'm leveraging the WebApplicationFactory
class and when I do this, my appsettings.json
file located in my test project is not getting used. The appsettings.development.json
file in the WebApi project (the SUT) is getting used.
I've tried to use Source Link/Source Debugging using the MS Symbol Server to step through the WebApplicationFactory
class to figure out why/what. It's a bit hard to grok.
I even sorta tried to use the TEST_CONTENTROOT_APPNAME
trick/hack I noticed in the source code but I couldn't get that to work properly (I think i'm not correctly adding this via my custom protected override IWebHostBuilder CreateWebHostBuilder()
method early on in the bootstrapping).
Anyways -> can anyone (repo members?) please provide some clues to how I can use my own appsettings.json
locally in my test project ... and not the ones in the SUT.
Why?
SUT appsettings.development.json
: db points to localhost
Test project appsettings.json
: db will point to some 'dev' server in the cloud.