Table of Contents

Create Method

Definition

Namespace
Codebelt.Extensions.Xunit.Hosting.AspNetCore
Assemblies
Codebelt.Extensions.Xunit.Hosting.AspNetCore.dll
Source
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebApplicationTestFactory.cs

Create<TEntryPoint>(Action<IWebHostBuilder>, IWebApplicationFixture<TEntryPoint>)

Creates and returns an IHostTest implementation.

public static IHostTest Create<TEntryPoint>(Action<IWebHostBuilder> webHostSetup = null, IWebApplicationFixture<TEntryPoint> hostFixture = null) where TEntryPoint : class

Parameters

webHostSetup Action<IWebHostBuilder>

The IWebHostBuilder which may be configured.

hostFixture IWebApplicationFixture<TEntryPoint>

An optional IWebApplicationFixture<TEntryPoint> implementation to use instead of the default ManagedWebApplicationFixture<TEntryPoint> instance.

Returns

IHostTest

An instance of an IHostTest implementation.

Type Parameters

TEntryPoint

A type in the entry point assembly of the application.

Remarks

When hostFixture is omitted, the factory uses ManagedWebApplicationFixture<TEntryPoint> so the application entry point owns deferred host startup. Pass another IWebApplicationFixture<TEntryPoint> implementation when the test requires a different lifecycle.