Table of Contents

Class WebApplicationTest<TEntryPoint, T>

Namespace
Codebelt.Extensions.Xunit.Hosting.AspNetCore
Assembly
Codebelt.Extensions.Xunit.Hosting.AspNetCore.dll

Represents a base class from which all implementations of unit testing, that uses Microsoft Dependency Injection and depends on an existing ASP.NET Core application entry point, should derive.

public abstract class WebApplicationTest<TEntryPoint, T> : HostTest, IAsyncLifetime, IHostTest, IConfigurationTest, IEnvironmentTest, ITest, IDisposable, IAsyncDisposable, IClassFixture<T> where TEntryPoint : class where T : class, IWebApplicationFixture<TEntryPoint>

Type Parameters

TEntryPoint

A type in the entry point assembly of the application.

T

The type of the object that implements the IWebApplicationFixture<TEntryPoint> interface.

Inheritance
WebApplicationTest<TEntryPoint, T>
Implements
IAsyncLifetime
IClassFixture<T>
Inherited Members

Constructors

WebApplicationTest(bool, T, ITestOutputHelper, Type)

Initializes a new instance of the WebApplicationTest<TEntryPoint, T> class.

protected WebApplicationTest(bool skipHostFixtureInitialization, T hostFixture, ITestOutputHelper output = null, Type callerType = null)

Parameters

skipHostFixtureInitialization bool

A value indicating whether to skip the host fixture initialization.

hostFixture T

An implementation of the IWebApplicationFixture<TEntryPoint> interface.

output ITestOutputHelper

An implementation of the Xunit.ITestOutputHelper interface.

callerType Type

The Type of caller that ends up invoking this instance.

Exceptions

ArgumentNullException

hostFixture is null.

WebApplicationTest(T, ITestOutputHelper, Type)

Initializes a new instance of the WebApplicationTest<TEntryPoint, T> class.

protected WebApplicationTest(T hostFixture, ITestOutputHelper output = null, Type callerType = null)

Parameters

hostFixture T

An implementation of the IWebApplicationFixture<TEntryPoint> interface.

output ITestOutputHelper

An implementation of the Xunit.ITestOutputHelper interface.

callerType Type

The Type of caller that ends up invoking this instance.

Properties

Server

Gets the TestServer initialized by the Host.

public TestServer Server { get; protected set; }

Property Value

TestServer

The TestServer initialized by the Host.

Methods

ConfigureWebHost(IWebHostBuilder)

Provides a way to override the IWebHostBuilder defaults before the application is built.

protected virtual void ConfigureWebHost(IWebHostBuilder builder)

Parameters

builder IWebHostBuilder

The IWebHostBuilder used to configure the application.

See Also

HostTest
IClassFixture<TFixture>