WebApplicationFactory<T> does not default to Development environment with minimal hosting #33889
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
bug
This issue describes a behavior which is not expected - a bug.
feature-minimal-hosting
investigate
Priority:0
Work that we can't release without
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Compared to the use cases for
IHostBuilder
andIWebHostBuilder
,WebApplicationFactory<T>
does not set the default environment for the application under test toDevelopment
when the code path for minimal hosting is used.aspnetcore/src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs
Line 383 in 9a451a3
aspnetcore/src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs
Line 402 in dbf84ea
aspnetcore/src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs
Lines 152 to 178 in dbf84ea
Adding the missing line itself does not seem to work though, possibly related to #33876 -
I've got some tests from debugging this locally I'll push up into a PR shortlysee #33890.To Reproduce
Inspect the
IHostEnvironment.EnvironmentName
property in, for example, theHelloWorld
test.aspnetcore/src/Mvc/test/Mvc.FunctionalTests/SimpleWithWebApplicationBuilderTests.cs
Lines 21 to 32 in 9a451a3
Further technical details
6.0.0-preview.6.21323.4
6.0.100-preview.6.21324.1
The text was updated successfully, but these errors were encountered: