Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic Host no longer calls ConfigureTestContainer for container overrides #17

Closed
ssunkari opened this issue Jan 10, 2020 · 1 comment

Comments

@ssunkari
Copy link

ssunkari commented Jan 10, 2020

I have Integration tests, which uses WebApplicationFactory net core interface.
Earlier netcore versions <3.0 has a way to override custom container registrations but once switched to generic host startup mode. The method override ConfigureTestContainer no longer get called. What do you recommend in terms of overriding the registrations in Autofac container for unit testing.

Below mehod is not called anymore in net core 3.

 .ConfigureTestContainer<ContainerBuilder>(containerBuilder =>
            { }

The order in which application bootstrap for IntegrationTests are:
Startup -> ConfigureServices
TestStartup -> ConfigureServices (Method Override if defined)
TestStartup -> ConfigureTestServices
Startup -> ConfigureContainer
TestStartup -> ConfigureTestContainer (Not called since netcore 3.0 upgrade with generic host usage)

There is a github issue on dotnet github page dotnet/aspnetcore#14907
but cannot find the solution.

@tillig
Copy link
Member

tillig commented Jan 10, 2020

Duplicate autofac/Autofac#1067.

@tillig tillig closed this as completed Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants