Exemple #1
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));
 }
 /// <summary>
 /// Adds the host factory for asp net core
 /// </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 AddAspNetCoreHostFactory(this TestingServerBuilder builder, string hostname, Action <IWebHostBuilder> configure)
 => builder.AddAspNetCoreHostFactory(options => options.HostName = hostname, configure);
 /// <summary>
 /// Adds the host factory for asp net core
 /// </summary>
 /// <param name="builder">The testing server builder</param>
 /// <param name="hostname">The hostname for the in memory host</param>
 /// <returns>The testing server builder</returns>
 public static TestingServerBuilder AddAspNetCoreHostFactory(this TestingServerBuilder builder, string hostname)
 => builder.AddAspNetCoreHostFactory(hostname, _ => { });
 /// <summary>
 /// Adds the host factory for asp net core
 /// </summary>
 /// <param name="builder">The testing server builder</param>
 /// <param name="configure">Configuration delegate for the web host</param>
 /// <returns>The testing server builder</returns>
 public static TestingServerBuilder AddAspNetCoreHostFactory(this TestingServerBuilder builder, Action <IWebHostBuilder> configure)
 => builder.AddAspNetCoreHostFactory(_defaultHostName, configure);
 /// <summary>
 /// Adds the host factory for asp net core
 /// </summary>
 /// <param name="builder">The testing server builder</param>
 /// <returns>The testing server builder</returns>
 public static TestingServerBuilder AddAspNetCoreHostFactory(this TestingServerBuilder builder)
 => builder.AddAspNetCoreHostFactory(_defaultHostName);