#272 Make HostingEnvironment default to Production.
This commit is contained in:
parent
5b851c49a3
commit
0e87d989d7
|
|
@ -8,7 +8,7 @@ namespace Microsoft.AspNet.Hosting
|
||||||
{
|
{
|
||||||
public class HostingEnvironment : IHostingEnvironment
|
public class HostingEnvironment : IHostingEnvironment
|
||||||
{
|
{
|
||||||
internal const string DefaultEnvironmentName = "Development";
|
internal const string DefaultEnvironmentName = "Production";
|
||||||
|
|
||||||
public string EnvironmentName { get; set; } = DefaultEnvironmentName;
|
public string EnvironmentName { get; set; } = DefaultEnvironmentName;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,15 +140,15 @@ namespace Microsoft.AspNet.Hosting
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void EnvDefaultsToDevelopmentIfNoConfig()
|
public void EnvDefaultsToProductionIfNoConfig()
|
||||||
{
|
{
|
||||||
var engine = CreateBuilder().Build();
|
var engine = CreateBuilder().Build();
|
||||||
var env = engine.ApplicationServices.GetRequiredService<IHostingEnvironment>();
|
var env = engine.ApplicationServices.GetRequiredService<IHostingEnvironment>();
|
||||||
Assert.Equal("Development", env.EnvironmentName);
|
Assert.Equal("Production", env.EnvironmentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void EnvDefaultsToDevelopmentConfigValueIfSpecifiedWithOldKey()
|
public void EnvDefaultsToConfigValueIfSpecifiedWithOldKey()
|
||||||
{
|
{
|
||||||
var vals = new Dictionary<string, string>
|
var vals = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
@ -164,7 +164,7 @@ namespace Microsoft.AspNet.Hosting
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void EnvDefaultsToDevelopmentConfigValueIfSpecified()
|
public void EnvDefaultsToConfigValueIfSpecified()
|
||||||
{
|
{
|
||||||
var vals = new Dictionary<string, string>
|
var vals = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
|
|
@ -195,8 +195,8 @@ namespace Microsoft.AspNet.Hosting
|
||||||
using (engine.Start())
|
using (engine.Start())
|
||||||
{
|
{
|
||||||
var env = engine.ApplicationServices.GetRequiredService<IHostingEnvironment>();
|
var env = engine.ApplicationServices.GetRequiredService<IHostingEnvironment>();
|
||||||
Assert.True(env.IsEnvironment("Development"));
|
Assert.True(env.IsEnvironment("Production"));
|
||||||
Assert.True(env.IsEnvironment("developMent"));
|
Assert.True(env.IsEnvironment("producTion"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue