RunWithHostBuilderContextAsync Method
Definition
- Namespace
- Codebelt.Extensions.Xunit.Hosting.AspNetCore
- Assemblies
- Codebelt.Extensions.Xunit.Hosting.AspNetCore.dll
RunWithHostBuilderContextAsync(Action<HostBuilderContext, IServiceCollection>, Action<HostBuilderContext, IApplicationBuilder>, Action<IHostApplicationBuilder>, Func<HttpClient, Task<HttpResponseMessage>>, IWebMinimalHostFixture)
Runs a filter/middleware test.
public static Task<HttpResponseMessage> RunWithHostBuilderContextAsync(Action<HostBuilderContext, IServiceCollection> serviceSetup = null, Action<HostBuilderContext, IApplicationBuilder> pipelineSetup = null, Action<IHostApplicationBuilder> hostSetup = null, Func<HttpClient, Task<HttpResponseMessage>> responseFactory = null, IWebMinimalHostFixture hostFixture = null)
Parameters
serviceSetupAction<HostBuilderContext, IServiceCollection>The IServiceCollection which may be configured.
pipelineSetupAction<HostBuilderContext, IApplicationBuilder>The IApplicationBuilder which may be configured.
hostSetupAction<IHostApplicationBuilder>The IHostBuilder 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 ("/").
hostFixtureIWebMinimalHostFixtureAn optional IWebHostFixture implementation to use instead of the default ManagedWebHostFixture instance.
Returns
- Task<HttpResponseMessage>
A Task that represents the asynchronous operation. The task result contains the HttpResponseMessage for the test server.