Table of Contents

Class WebApplicationFactory

Namespace
Whipstaff.AspNetCore.Features.ApplicationStartup
Assembly
Whipstaff.AspNetCore.dll

Helper class for creating a IHost.

public static class WebApplicationFactory
Inheritance
WebApplicationFactory
Inherited Members

Methods

GetHostApplicationBuilder<TStartup>(WebApplicationOptions, Action<WebApplicationBuilder>?)

Gets a host builder based on the provided startup class.

public static WebApplication GetHostApplicationBuilder<TStartup>(WebApplicationOptions options, Action<WebApplicationBuilder>? builderOverrideAction) where TStartup : IWhipstaffWebAppStartup, new()

Parameters

options WebApplicationOptions

Options to set the web application up with.

builderOverrideAction Action<WebApplicationBuilder>

Action to override the builder setup. Typically used to inject a test host etc.

Returns

WebApplication

The host builder instance.

Type Parameters

TStartup

The type for the startup class. This is not an interface based on the ASP.NET core IStartup, this one provides hosting context and takes the app away from reflection whilst enforcing some design contract.

GetHostApplicationBuilder<TStartup>(string[], Action<WebApplicationBuilder>?)

Gets a host builder based on the provided startup class.

public static WebApplication GetHostApplicationBuilder<TStartup>(string[] args, Action<WebApplicationBuilder>? builderOverrideAction) where TStartup : IWhipstaffWebAppStartup, new()

Parameters

args string[]

Command line arguments.

builderOverrideAction Action<WebApplicationBuilder>

Action to override the builder setup. Typically used to inject a test host etc.

Returns

WebApplication

The host builder instance.

Type Parameters

TStartup

The type for the startup class. This is not an interface based on the ASP.NET core IStartup, this one provides hosting context and takes the app away from reflection whilst enforcing some design contract.