Describe the bug
Using .net 6 minimal APIs and WebApplicationFactory for testing, the test config override is only applied after .Build.
This means any interaction with config while configuring services using builder.Configuration will be using the app configuration, not test overrides.
To Reproduce
I've created a repo that shows the difference, here is the Program, and an Example test.
Test run
Further technical details
- ASP.NET Core version: net6.0
Describe the bug
Using .net 6 minimal APIs and WebApplicationFactory for testing, the test config override is only applied after .Build.
This means any interaction with config while configuring services using
builder.Configurationwill be using the app configuration, not test overrides.To Reproduce
I've created a repo that shows the difference, here is the Program, and an Example test.
Test run
Further technical details