Table of Contents

Class GenericHostFixtureExtensions

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

Extension methods for the IGenericHostFixture interface.

public static class GenericHostFixtureExtensions
Inheritance
GenericHostFixtureExtensions

Examples

The following example validates that an IGenericHostFixture has been fully configured by calling HasValidState on the fixture. The method returns true only when both ConfigureServicesCallback and ConfigureHostCallback are non-null.

using Codebelt.Extensions.Xunit.Hosting;

namespace HostFixtureTests;

public class HostStateGuard
{
    public bool EnsureFixtureIsReady(IGenericHostFixture fixture)
    {
        return fixture.HasValidState();
    }
}

Methods

HasValidState(IGenericHostFixture)

Determines whether the specified IGenericHostFixture has a valid state.

public static bool HasValidState(this IGenericHostFixture hostFixture)

Parameters

hostFixture IGenericHostFixture

The IGenericHostFixture to check.

Returns

bool

true if the specified IGenericHostFixture has a valid state; otherwise, false.

Remarks

A valid state is defined as having non-null values for the following properties: ConfigureServicesCallback and ConfigureHostCallback.