I want to use the IHostingEnvironment
and ConfigurationBuilder
in my functional test project, so that depending on the environment the functional tests run using a different set of configuration. I want to make use of the code below:
public IConfigurationRoot ConfigureConfiguration(IHostingEnvironment hostingEnvironment)
{
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{hostingEnvironment.EnvironmentName}.json", true)
.AddEnvironmentVariables();
return builder.Build();
}
I want to have an appSettings.json
and appSettings.Production.json
file to point my functional tests at production. Is this possible? How can it be achieved? I would need an instance of IHostingEnvironment
.