public void can_bootstrap_a_host() { var input = new AspNetCoreInput { WebHostBuilder = new WebHostBuilder() .UseServer(new NulloServer()) .UseStartup <EmptyStartup>() }; using (var host = input.BuildHost()) { host.ShouldNotBeNull(); } }
public void modify_the_environment() { var input = new AspNetCoreInput { WebHostBuilder = new WebHostBuilder() .UseServer(new NulloServer()) .UseStartup <EmptyStartup>(), EnvironmentFlag = "Weird" }; using (var host = input.BuildHost()) { host.Services.GetRequiredService <IHostingEnvironment>() .EnvironmentName.ShouldBe("Weird"); } }
public void modify_configuration_items() { var input = new AspNetCoreInput { WebHostBuilder = new WebHostBuilder() .UseServer(new NulloServer()) .UseStartup <EmptyStartup>(), ConfigFlag = new Dictionary <string, string> { { "direction", "south" }, { "color", "orange" } } }; using (var host = input.BuildHost()) { var config = host.Services.GetRequiredService <IConfiguration>(); config["direction"].ShouldBe("south"); config["color"].ShouldBe("orange"); } }