public virtual async Task InitAsync() { TestWebHost.IsTest = true; var hostBuilder = TestWebHost.CreateHostBuilder(GetHostArgs()); await ConfigureWebHost(hostBuilder); WebHost = await hostBuilder.StartAsync(); HttpRequestGlobalOptions.DefaultHttpMessageInvokerFactory = new TestCutureHttpClientFactory(WebHost.GetTestClient()); HttpRequestGlobalOptions.DefaultConnectionLimit = 500; }
public virtual async Task InitAsync() { IHttpMessageInvokerFactory invokerFactory = null; if (TestWebHost.HostByTestHost) { var hostBuilder = TestWebHost.CreateHostBuilder(System.Array.Empty <string>(), UseTestServer); ServerHost = await hostBuilder.StartAsync(); if (UseTestServer) { invokerFactory = new TestHttpMessageInvokerFactory(ServerHost.GetTestClient()); } } invokerFactory ??= new SimpleHttpMessageInvokerFactory(); HttpRequestGlobalOptions.DefaultConnectionLimit = 10; HttpRequestGlobalOptions.DefaultHttpMessageInvokerFactory = invokerFactory; }