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

ConfigureTestContainer not working with GenericHost #1067

Closed
ssunkari opened this issue Jan 10, 2020 · 2 comments
Closed

ConfigureTestContainer not working with GenericHost #1067

ssunkari opened this issue Jan 10, 2020 · 2 comments

Comments

@ssunkari
Copy link

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

Unfortunately, the hosting system and how it handles test containers is .NET Core code, not Autofac. If you find a reproducible bug or need an Autofac enhancement, please file an issue explaining it. Otherwise, please ask usage questions on StackOverflow or, as you've already done, file an issue with the appropriate group. Thanks!

@oliverhanappi
Copy link

For workarounds, see #1207

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

3 participants