WebApplicationFactory<TEntryPoint>.WithWebHostBuilder Method

Definition

Creates a new WebApplicationFactory<TEntryPoint> with a IWebHostBuilder that is further customized by configuration.

public:
 Microsoft::AspNetCore::Mvc::Testing::WebApplicationFactory<TEntryPoint> ^ WithWebHostBuilder(Action<Microsoft::AspNetCore::Hosting::IWebHostBuilder ^> ^ configuration);
public Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory<TEntryPoint> WithWebHostBuilder (Action<Microsoft.AspNetCore.Hosting.IWebHostBuilder> configuration);
member this.WithWebHostBuilder : Action<Microsoft.AspNetCore.Hosting.IWebHostBuilder> -> Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory<'EntryPoint (requires 'EntryPoint : null)>
Public Function WithWebHostBuilder (configuration As Action(Of IWebHostBuilder)) As WebApplicationFactory(Of TEntryPoint)

Parameters

configuration
Action<IWebHostBuilder>

An Action<T> to configure the IWebHostBuilder.

Returns

A new WebApplicationFactory<TEntryPoint>.

Applies to