Class MinimalWebHostTest<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 ASP.NET Core (minimal style), should derive.
public abstract class MinimalWebHostTest<T> : MinimalHostTest, IAsyncLifetime, IWebHostTest, IHostTest, IConfigurationTest, IEnvironmentTest, ITest, IDisposable, IAsyncDisposable, IPipelineTest, IClassFixture<T> where T : class, IWebMinimalHostFixture
Type Parameters
TThe type of the object that implements the IWebMinimalHostFixture interface.
- Inheritance
-
MinimalWebHostTest<T>
- Implements
-
IAsyncLifetimeIClassFixture<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
MinimalWebHostTest(bool, T, ITestOutputHelper, Type)
Initializes a new instance of the MinimalWebHostTest<T> class.
protected MinimalWebHostTest(bool skipHostFixtureInitialization, T hostFixture, ITestOutputHelper output = null, Type callerType = null)
Parameters
skipHostFixtureInitializationboolA value indicating whether to skip the host fixture initialization.
hostFixtureTAn implementation of the IWebMinimalHostFixture interface.
outputITestOutputHelperAn implementation of the Xunit.Abstractions.ITestOutputHelper interface.
callerTypeTypeThe Type of caller that ends up invoking this instance.
Exceptions
- ArgumentNullException
hostFixtureis null.
MinimalWebHostTest(T, ITestOutputHelper, Type)
Initializes a new instance of the MinimalWebHostTest<T> class.
protected MinimalWebHostTest(T hostFixture, ITestOutputHelper output = null, Type callerType = null)
Parameters
hostFixtureTAn implementation of the IWebMinimalHostFixture interface.
outputITestOutputHelperAn implementation of the Xunit.Abstractions.ITestOutputHelper interface.
callerTypeTypeThe Type of caller that ends up invoking this instance.
Properties
Application
Gets the IApplicationBuilder initialized by the IHost.
public IApplicationBuilder Application { get; protected set; }
Property Value
- IApplicationBuilder
The IApplicationBuilder initialized by the IHost.
Methods
ConfigureApplication(IApplicationBuilder)
Configures the HTTP request pipeline.
public abstract void ConfigureApplication(IApplicationBuilder app)
Parameters
appIApplicationBuilderThe type that provides the mechanisms to configure the HTTP request pipeline.