71 references to Environments
Aspire.Hosting.Testing (1)
DistributedApplicationFactory.cs (1)
154hostBuilderOptions.EnvironmentName = Environments.Development;
Aspire.Hosting.Tests (1)
Utils\TestDistributedApplicationBuilder.cs (1)
92hostBuilderOptions.EnvironmentName = Environments.Development;
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (2)
AspireAzureEfCoreCosmosDBExtensionsTests.cs (2)
159var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings { EnvironmentName = Environments.Development }); 182var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings { EnvironmentName = Environments.Production });
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (2)
AspireSqlServerEFCoreSqlClientExtensionsTests.cs (2)
260var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings { EnvironmentName = Environments.Development }); 283var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings { EnvironmentName = Environments.Production });
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (2)
AspireEFPostgreSqlExtensionsTests.cs (2)
267var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings { EnvironmentName = Environments.Development }); 290var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings { EnvironmentName = Environments.Production });
Aspire.Oracle.EntityFrameworkCore.Tests (2)
AspireOracleEFCoreDatabaseExtensionsTests.cs (2)
261var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings { EnvironmentName = Environments.Development }); 284var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings { EnvironmentName = Environments.Production });
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (2)
AspireEFMySqlExtensionsTests.cs (2)
255var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings { EnvironmentName = Environments.Development }); 278var builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings { EnvironmentName = Environments.Production });
Microsoft.AspNetCore.Authorization.Test (1)
AuthorizationMiddlewareTests.cs (1)
979EnvironmentName = Environments.Development
Microsoft.AspNetCore.Components.Endpoints.Tests (6)
EndpointHtmlRendererTest.cs (3)
888.AddSingleton<IHostEnvironment>(new TestEnvironment(Environments.Development)) 917.AddSingleton<IHostEnvironment>(new TestEnvironment(Environments.Development)) 1010.AddSingleton<IHostEnvironment>(new TestEnvironment(Environments.Development))
RazorComponentResultTest.cs (3)
314var httpContext = GetTestHttpContext(isDevelopmentEnvironment ? Environments.Development : Environments.Production); 454x => x.EnvironmentName == (environmentName ?? Environments.Production));
Microsoft.AspNetCore.Hosting (1)
Internal\HostingEnvironment.cs (1)
14public string EnvironmentName { get; set; } = Extensions.Hosting.Environments.Production;
Microsoft.AspNetCore.Hosting.Tests (20)
StartupManagerTests.cs (10)
553var startup = StartupLoader.LoadMethods(services, typeof(MyContainerStartup), Environments.Development); 569var startup = StartupLoader.LoadMethods(services, typeof(MyContainerStartupBaseClass), Environments.Development); 585var startup = StartupLoader.LoadMethods(services, typeof(MyContainerStartupEnvironmentBased), Environments.Production); 591Assert.Equal(((MyContainer)app.ApplicationServices).Environment, Environments.Production); 600var startup = StartupLoader.LoadMethods(services, typeof(MyContainerStartup), Environments.Development); 611Assert.Throws<InvalidOperationException>(() => StartupLoader.LoadMethods(services, typeof(MyContainerStartupBaseClass), Environments.Development)); 621Assert.Throws<InvalidOperationException>(() => StartupLoader.LoadMethods(services, typeof(MyContainerStartupWithOverloads), Environments.Development)); 631var startup = StartupLoader.LoadMethods(services, typeof(MyContainerStartup), Environments.Development); 672container.Environment = Environments.Development; 677container.Environment = Environments.Production;
WebHostConfigurationsTests.cs (4)
19{ WebHostDefaults.EnvironmentKey, Environments.Development}, 30Assert.Equal(Environments.Development, config.Environment); 39var parameters = new Dictionary<string, string>() { { "ENVIRONMENT", Environments.Development } }; 42Assert.Equal(Environments.Development, config.Environment);
WebHostTests.cs (6)
805Assert.Equal(Environments.Production, env.EnvironmentName); 806Assert.Equal(Environments.Production, env2.EnvironmentName); 815{ "Environment", Environments.Staging } 828Assert.Equal(Environments.Staging, env.EnvironmentName); 829Assert.Equal(Environments.Staging, env.EnvironmentName); 866Assert.True(env.IsEnvironment(Environments.Production));
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
SimpleWithWebApplicationBuilderTests.cs (1)
184builder.UseEnvironment(Environments.Staging);
Microsoft.AspNetCore.Mvc.Testing (3)
WebApplicationFactory.cs (3)
160deferredHostBuilder.UseEnvironment(Environments.Development); 396hostBuilder?.UseEnvironment(Environments.Development); 415return builder.UseEnvironment(Environments.Development);
Microsoft.AspNetCore.Tests (16)
WebApplicationTests.cs (16)
699EnvironmentName = isDevelopment ? Environments.Development : Environments.Production 724EnvironmentName = isDevelopment ? Environments.Development : Environments.Production 740EnvironmentName = Environments.Development 747Assert.Equal(Environments.Development, webApplication.Environment.EnvironmentName); 757EnvironmentName = Environments.Development 772EnvironmentName = Environments.Development 2027var builder = createBuilder(new WebApplicationOptions() { EnvironmentName = Environments.Development }); 2049var builder = createBuilder(new WebApplicationOptions() { EnvironmentName = Environments.Development }); 2067var builder = createBuilder(new WebApplicationOptions() { EnvironmentName = Environments.Production }); 2074var builder = CreateEmptyBuilderOptions(new WebApplicationOptions() { EnvironmentName = Environments.Development }); 2133var builder = createBuilder(new WebApplicationOptions() { EnvironmentName = Environments.Development }); 2158var builder = createBuilder(new WebApplicationOptions() { EnvironmentName = Environments.Production }); 2278EnvironmentName = Environments.Staging, 2297Assert.Equal(Environments.Staging, hostEnv.EnvironmentName);
Microsoft.Extensions.Hosting (1)
HostBuilder.cs (1)
231EnvironmentName = hostConfiguration[HostDefaults.EnvironmentKey] ?? Environments.Production,
Microsoft.Extensions.Hosting.Abstractions (9)
HostEnvironmentEnvExtensions.cs (9)
14/// Checks if the current host environment name is <see cref="Environments.Development"/>. 17/// <returns><see langword="true"/> if the environment name is <see cref="Environments.Development"/>, otherwise <see langword="false"/>.</returns> 22return hostEnvironment.IsEnvironment(Environments.Development); 26/// Checks if the current host environment name is <see cref="Environments.Staging"/>. 29/// <returns><see langword="true"/> if the environment name is <see cref="Environments.Staging"/>, otherwise <see langword="false"/>.</returns> 34return hostEnvironment.IsEnvironment(Environments.Staging); 38/// Checks if the current host environment name is <see cref="Environments.Production"/>. 41/// <returns><see langword="true"/> if the environment name is <see cref="Environments.Production"/>, otherwise <see langword="false"/>.</returns> 46return hostEnvironment.IsEnvironment(Environments.Production);
SampleStartups (1)
StartupFullControl.cs (1)
32.UseEnvironment(Environments.Development)