Class WebMinimalHostFixtureExtensions
- Namespace
- Codebelt.Extensions.Xunit.Hosting.AspNetCore
- Assembly
- Codebelt.Extensions.Xunit.Hosting.AspNetCore.dll
Extension methods for the IWebMinimalHostFixture interface.
public static class WebMinimalHostFixtureExtensions
- Inheritance
-
WebMinimalHostFixtureExtensions
Examples
The following example validates that an IWebMinimalHostFixture has a valid initialized state by calling HasValidState. The method checks the minimal host fixture state and additionally verifies that the application callback and application pipeline are configured.
using Codebelt.Extensions.Xunit.Hosting.AspNetCore;
namespace WebFixtureTests;
public class WebMinimalHostStateGuard
{
public bool EnsureFixtureIsReady(IWebMinimalHostFixture fixture)
{
return fixture.HasValidState();
}
}
Methods
HasValidState(IWebMinimalHostFixture)
Determines whether the specified IWebMinimalHostFixture has a valid state.
public static bool HasValidState(this IWebMinimalHostFixture hostFixture)
Parameters
hostFixtureIWebMinimalHostFixtureThe IWebMinimalHostFixture to check.
Returns
- bool
trueif the specified IWebMinimalHostFixture has a valid state; otherwise,false.
Remarks
A valid state is defined as having non-null values for the following properties: ConfigureHostCallback, ConfigureCallback, ConfigureApplicationCallback, Application and Host.