public static TestingServerBuilder ConfigureAspNetCoreHost(this TestingServerBuilder builder, Action <AspNetCoreHostOptions> configureOptions)
 {
     return(builder.AddTestingServices(services =>
     {
         services.Configure(configureOptions);
     }));
 }
コード例 #2
0
 /// <summary>
 /// Adds the host factory for asp net core hosted on https
 /// </summary>
 /// <param name="builder">The testing server builder</param>
 /// <param name="hostname">The hostname for the in memory host</param>
 /// <param name="configure">Configuration delegate for the web host</param>
 /// <returns>The testing server builder</returns>
 public static TestingServerBuilder AddAspNetCoreHttpsHostFactory(this TestingServerBuilder builder, string hostname, Action <IWebHostBuilder> configure)
 {
     builder
     .AddTestingServices(services =>
     {
         services
         .AddSingleton <ISelfSignedCertificateFactory, SelfSignedCertificateFactory>()
         .AddSingleton <IWebHostFactory, HttpsWebHostFactory>()
         .AddSingleton <IConfigureOptions <HttpClientFactoryOptions>, ConfigureNamedHttpClientFactoryOptions>()
         ;
         services.TryAddTransient <IHttpClientProvider, TestingHttpClientProvider>();
     })
     ;
     return(builder.AddAspNetCoreHostFactory(hostname, configure));
 }