-
-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Issue
If the main host consumes/uses this library, then when trying to create an integration test (to test the route, etc), the following error occurs:
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.
Solution
The reason is, the testing framework is trying to find a hardcoded method name. SimpleHosting has it's own method name and as such, can't be found. Therefore, some documentation is required to explain to a developer how she/he can successfully test (by creating their own custom WebApplicationFactory and possible consider wrapping this into a nuget package.