You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This aligns with the expected behavior of the internal resolver, it'll search for variations of CreateHostBuilder, and if it's not found, kick off the entry-point to check if it's a WebApplicationBuilder project. I expect most people using .NET 6 and newer will be using WebApplicationBuilder, but I'll add a note that the application needs to conform with default template conventions if using CreateHostBuilder.
.NET 6, Alba 7.2.1
Using the following test...
..when SUT is...
...leads to a successful test! (i.e. Main was never called)
Renaming the CreateHostBuilder method to CreateHostBuilder2 and thus using SUT as ...
...leads to a failed test as the exception is thrown. (i.e. Main was called)
I guess this has to do with the logic in EnsureServer() (as described by Andrew Lock in https://andrewlock.net/exploring-dotnet-6-part-6-supporting-integration-tests-with-webapplicationfactory-in-dotnet-6/) that looks for older ways of doing things and uses the ASP.NET Core 3.x/5 convention when it finds a method named CreateHostBuilder.
Don't know if there's something to do about this or if just should be documented somewhere?
The text was updated successfully, but these errors were encountered: