Skip to content

Minimal API test config overrides only apply after app has been built #37680

@maisiesadler

Description

@maisiesadler

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

Metadata

Metadata

Assignees

Labels

DocsThis issue tracks updating documentationarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-hostingfeature-mvc-testingMVC testing packagenet8_docathonThis issue is part of the documentation push in Fall 2023.

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions