Table of Contents

HostTest<T> Class

Definition

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

Represents a base class from which all implementations of unit testing, that uses Microsoft Dependency Injection, should derive.

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

Type Parameters

T

The type of the object that implements the IGenericHostFixture interface.

Inheritance
HostTest<T>
Implements
IAsyncLifetime
IClassFixture<T>
Derived
Inherited Members

Remarks

The class needed to be designed in this rather complex way, as this is the only way that xUnit supports a shared context. The need for shared context is theoretical at best, but it does opt-in for Scoped instances.

Constructors

Name Description
HostTest(bool, T, ITestOutputHelper, Type)

Initializes a new instance of the HostTest<T> class.

HostTest(T, ITestOutputHelper, Type)

Initializes a new instance of the HostTest<T> class.

Methods

Name Description
ConfigureHost(IHostBuilder)

Provides a way to override the IHostBuilder defaults set up by T.

ConfigureServices(IServiceCollection)

Adds services to the container.

See Also

HostTest
IHostTest
IClassFixture<TFixture>