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

No one assigned

    Labels

    area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-hostingfeature-mvc-testingMVC testing packageon-roadmapListed on the current release roadmap
    No fields configured for Feature.

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions