public void should_be_override() { var recorder = new SimpleRecorder(); string environmentName = EnvironmentName.Development; new WebHostBuilder().UseEnvironment(environmentName) .ConfigureServices(s => s.AddSingleton(recorder)) .ConfigureEnvironment ( (environmentName, EnvironmentSetup.Create <NullWebHostConfigurator, DevStartup>()) ) .UseStartup <ProdStartup>() .Build(); Assert.Equal("ProdStartup.ConfigureServices", recorder.Records.Single()); }
public void should_call_different_startup_for_specific_environment_using_type( string environmentName, string selectedStartup) { var recorder = new SimpleRecorder(); new WebHostBuilder().UseEnvironment(environmentName) .ConfigureServices(s => s.AddSingleton(recorder)) .ConfigureEnvironment ( ("Development", EnvironmentSetup.Create <NullWebHostConfigurator, DevStartup>()), ("Production", EnvironmentSetup.Create <NullWebHostConfigurator, ProdStartup>()) ) .Build(); Assert.Equal( new[] { $"{selectedStartup}.ConfigureServices" }, recorder.Records); }
public ProdStartup(SimpleRecorder recorder) : base(recorder) { }
public DevStartup(SimpleRecorder recorder) : base(recorder) { }
public TestStartupBase(SimpleRecorder recorder) { this.recorder = recorder; }