Table of Contents

WebApplicationFixtureExtensions Class

Definition

Extension methods for the IWebApplicationFixture<TEntryPoint> interface.

public static class WebApplicationFixtureExtensions
Inheritance
WebApplicationFixtureExtensions

Examples

The following example validates that an IWebApplicationFixture<TEntryPoint> has a valid initialized state by calling HasValidState<TEntryPoint>. The method checks that the host, configure callback, and configure-web-host callback are all non-null.

using Codebelt.Extensions.Xunit.Hosting.AspNetCore;

namespace WebFixtureTests;

public class WebAppStateGuard
{
    public bool EnsureFixtureIsReady<TEntryPoint>(IWebApplicationFixture<TEntryPoint> fixture) where TEntryPoint : class
    {
        return fixture.HasValidState<TEntryPoint>();
    }
}

Methods

Name Description
HasValidState<TEntryPoint>(IWebApplicationFixture<TEntryPoint>)

Determines whether the specified IWebApplicationFixture<TEntryPoint> has a valid state.