Table of Contents

Class MinimalHostTest<T>

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

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

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

Type Parameters

T

The type of the object that implements the IGenericHostFixture interface.

Inheritance
MinimalHostTest<T>
Implements
IAsyncLifetime
IClassFixture<T>
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

MinimalHostTest(T, ITestOutputHelper, Type)

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

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

Parameters

hostFixture T

An implementation of the IMinimalHostFixture interface.

output ITestOutputHelper

An implementation of the Xunit.Abstractions.ITestOutputHelper interface.

callerType Type

The Type of caller that ends up invoking this instance.

Exceptions

ArgumentNullException

hostFixture is null.

MinimalHostTest(Boolean, T, ITestOutputHelper, Type)

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

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

Parameters

skipHostFixtureInitialization Boolean

A value indicating whether to skip the host fixture initialization.

hostFixture T

An implementation of the IGenericHostFixture interface.

output ITestOutputHelper

An implementation of the Xunit.Abstractions.ITestOutputHelper interface.

callerType Type

The Type of caller that ends up invoking this instance.

Exceptions

ArgumentNullException

hostFixture is null.

See Also

HostTest
IClassFixture<TFixture>