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

Provide documentation (and, or NuGet?) for testing an application which consumes this library. #3

Open
PureKrome opened this issue Jan 15, 2021 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers

Comments

@PureKrome
Copy link
Owner

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.

@PureKrome PureKrome added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers labels Jan 15, 2021
@PureKrome PureKrome self-assigned this Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant