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
Starting from asp.net core 3.0, when making integration tests with WebApplicationFactory, it searches for either
a method called CreateWebHostBuilder with a return an IWebHostBuilder
or one called CreateHostBuilder returning an IHostBuilder.
It crashes if it doesn't find any of those two.
In the mustache template for Program.cs, we have a mix of both (IHostBuilder CreateWebHostBuilder).
I suggest changing it to IHostBuilder CreateHostBuilder().
openapi-generator version
v4.3.1
OpenAPI declaration file content or url
the petstore.yaml file would do
Command line used for generation
the default one
Steps to reproduce
generate the code
add a integration tests project that uses WebApplicationFactory
start the test
it crashes with the message : System.InvalidOperationException : No method 'public static IHostBuilder CreateHostBuilder(string[] args)' or 'public static IWebHostBuilder CreateWebHostBuilder(string[] args)' found on 'API.Program'. Alternatively, WebApplicationFactory`1 can be extended and 'CreateHostBuilder' or 'CreateWebHostBuilder' can be overridden to provide your own instance.
Related issues/PRs
none
Suggest a fix
I suggest changing it to IHostBuilder CreateHostBuilder().
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
Starting from asp.net core 3.0, when making integration tests with WebApplicationFactory, it searches for either
It crashes if it doesn't find any of those two.
In the mustache template for Program.cs, we have a mix of both (IHostBuilder CreateWebHostBuilder).
I suggest changing it to IHostBuilder CreateHostBuilder().
openapi-generator version
v4.3.1
OpenAPI declaration file content or url
the petstore.yaml file would do
Command line used for generation
the default one
Steps to reproduce
it crashes with the message : System.InvalidOperationException : No method 'public static IHostBuilder CreateHostBuilder(string[] args)' or 'public static IWebHostBuilder CreateWebHostBuilder(string[] args)' found on 'API.Program'. Alternatively, WebApplicationFactory`1 can be extended and 'CreateHostBuilder' or 'CreateWebHostBuilder' can be overridden to provide your own instance.
Related issues/PRs
none
Suggest a fix
I suggest changing it to IHostBuilder CreateHostBuilder().
The text was updated successfully, but these errors were encountered: