Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
public SelfContainedWebApplicationFactoryWithWebHost(System.Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> configureServices, System.Action<Microsoft.AspNetCore.Builder.IApplicationBuilder> configure) { }
public SelfContainedWebApplicationFactoryWithWebHost(System.Action<Microsoft.AspNetCore.Hosting.WebHostBuilderContext, Microsoft.Extensions.DependencyInjection.IServiceCollection> configureServices, System.Action<Microsoft.AspNetCore.Hosting.WebHostBuilderContext, Microsoft.AspNetCore.Builder.IApplicationBuilder> configure) { }
public System.Action<Microsoft.AspNetCore.Hosting.IWebHostBuilder> BuilderCustomization { get; set; }
public string Environment { get; set; }
protected override void ConfigureWebHost(Microsoft.AspNetCore.Hosting.IWebHostBuilder builder) { }
protected override Microsoft.Extensions.Hosting.IHostBuilder CreateHostBuilder() { }
}
Expand All @@ -22,6 +23,7 @@
{
public WebApplicationFactoryWithWebHost() { }
public System.Action<Microsoft.AspNetCore.Hosting.IWebHostBuilder> BuilderCustomization { get; set; }
public string Environment { get; set; }
protected override void ConfigureWebHost(Microsoft.AspNetCore.Hosting.IWebHostBuilder builder) { }
protected override Microsoft.Extensions.Hosting.IHostBuilder CreateHostBuilder() { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class SelfContainedWebApplicationFactoryWithWebHost<TEntryPoint> :
readonly Action<WebHostBuilderContext, IServiceCollection> _configureServicesWithWebHostBuilderContext;
readonly Action<WebHostBuilderContext, IApplicationBuilder> _configureWithWebHostBuilderContext;

public string Environment { get; set; } = Environments.Development;
public Action<IWebHostBuilder> BuilderCustomization { get; set; }

public SelfContainedWebApplicationFactoryWithWebHost(Action<IServiceCollection> configureServices, Action<IApplicationBuilder> configure)
Expand All @@ -41,6 +42,7 @@ public SelfContainedWebApplicationFactoryWithWebHost(Action<WebHostBuilderContex
protected override IHostBuilder CreateHostBuilder()
{
return Host.CreateDefaultBuilder(Array.Empty<string>())
.UseEnvironment(Environment)
.ConfigureWebHostDefaults(webBuilder =>
{
if (_configureServices != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ public class WebApplicationFactoryWithWebHost<TStartup> :
WebApplicationFactory<TStartup>
where TStartup : class
{
public string Environment { get; set; } = Environments.Development;
public Action<IWebHostBuilder> BuilderCustomization { get; set; }

protected override IHostBuilder CreateHostBuilder()
{
return Host.CreateDefaultBuilder(Array.Empty<string>())
.UseEnvironment(Environment)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<TStartup>();
Expand Down