共用方式為


WebApplicationFactory<TEntryPoint>.WithWebHostBuilder 方法

定義

使用 進一步自訂 configuration 的 , IWebHostBuilder 建立新的 WebApplicationFactory<TEntryPoint>

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)

參數

configuration
Action<IWebHostBuilder>

設定 IWebHostBuilderAction<T>

傳回

新的 WebApplicationFactory<TEntryPoint>

適用於