RunAsync Method
Definition
- Namespace
- Codebelt.Extensions.Xunit.Hosting.AspNetCore
- Assemblies
- Codebelt.Extensions.Xunit.Hosting.AspNetCore.dll
RunAsync<TEntryPoint>(Action<IWebHostBuilder>, Func<HttpClient, Task<HttpResponseMessage>>, IWebApplicationFixture<TEntryPoint>)
Runs an ASP.NET Core application and returns an HttpResponseMessage for the test server.
public static Task<HttpResponseMessage> RunAsync<TEntryPoint>(Action<IWebHostBuilder> webHostSetup = null, Func<HttpClient, Task<HttpResponseMessage>> responseFactory = null, IWebApplicationFixture<TEntryPoint> hostFixture = null) where TEntryPoint : class
Parameters
webHostSetupAction<IWebHostBuilder>The IWebHostBuilder which may be configured.
responseFactoryFunc<HttpClient, Task<HttpResponseMessage>>The function delegate that creates a HttpResponseMessage from the HttpClient. Default is a GET request to the root URL ("/").
hostFixtureIWebApplicationFixture<TEntryPoint>An optional IWebApplicationFixture<TEntryPoint> implementation to use instead of the default ManagedWebApplicationFixture<TEntryPoint> instance.
Returns
- Task<HttpResponseMessage>
A Task that represents the asynchronous operation. The task result contains the HttpResponseMessage for the test server.
Type Parameters
TEntryPointA type in the entry point assembly of the application.