From a3fca566c5877abe921d3657a2961b5baacf74bd Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Mon, 4 Apr 2016 10:14:27 -0700 Subject: [PATCH] Uncomment test code and change ASPNET_ENV to ASPNETCORE_ENVIRONMENT --- src/MusicStore/Startup.cs | 6 +++--- src/MusicStore/StartupNtlmAuthentication.cs | 8 ++++---- src/MusicStore/StartupOpenIdConnect.cs | 6 +++--- test/E2ETests/Implementation/FacebookLoginScenarios.cs | 6 +++++- test/E2ETests/Implementation/GoogleLoginScenarios.cs | 6 +++++- .../MicrosoftAccountAuthenticationScenarios.cs | 6 +++++- 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index 921d2b6452..7be45a3eb9 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -92,7 +92,7 @@ namespace MusicStore }); } - //This method is invoked when ASPNET_ENV is 'Development' or is not defined + //This method is invoked when ASPNETCORE_ENVIRONMENT is 'Development' or is not defined //The allowed values are Development,Staging and Production public void ConfigureDevelopment(IApplicationBuilder app, ILoggerFactory loggerFactory) { @@ -115,7 +115,7 @@ namespace MusicStore Configure(app); } - //This method is invoked when ASPNET_ENV is 'Staging' + //This method is invoked when ASPNETCORE_ENVIRONMENT is 'Staging' //The allowed values are Development,Staging and Production public void ConfigureStaging(IApplicationBuilder app, ILoggerFactory loggerFactory) { @@ -129,7 +129,7 @@ namespace MusicStore Configure(app); } - //This method is invoked when ASPNET_ENV is 'Production' + //This method is invoked when ASPNETCORE_ENVIRONMENT is 'Production' //The allowed values are Development,Staging and Production public void ConfigureProduction(IApplicationBuilder app, ILoggerFactory loggerFactory) { diff --git a/src/MusicStore/StartupNtlmAuthentication.cs b/src/MusicStore/StartupNtlmAuthentication.cs index a3c61a4c9a..6a4f0c79d4 100644 --- a/src/MusicStore/StartupNtlmAuthentication.cs +++ b/src/MusicStore/StartupNtlmAuthentication.cs @@ -16,18 +16,18 @@ namespace MusicStore /// /// To make runtime to load an environment based startup class, specify the environment by the following ways: /// 1. Drop a Microsoft.AspNetCore.Hosting.ini file in the wwwroot folder - /// 2. Add a setting in the ini file named 'ASPNET_ENV' with value of the format 'Startup[EnvironmentName]'. + /// 2. Add a setting in the ini file named 'ASPNETCORE_ENVIRONMENT' with value of the format 'Startup[EnvironmentName]'. /// For example: To load a Startup class named 'StartupNtlmAuthentication' the value of the env should be - /// 'NtlmAuthentication' (eg. ASPNET_ENV=NtlmAuthentication). Runtime adds a 'Startup' prefix to this and + /// 'NtlmAuthentication' (eg. ASPNETCORE_ENVIRONMENT=NtlmAuthentication). Runtime adds a 'Startup' prefix to this and /// loads 'StartupNtlmAuthentication'. /// If no environment name is specified the default startup class loaded is 'Startup'. /// /// Alternative ways to specify environment are: - /// 1. Set the environment variable named SET ASPNET_ENV=NtlmAuthentication + /// 1. Set the environment variable named SET ASPNETCORE_ENVIRONMENT=NtlmAuthentication /// 2. For selfhost based servers pass in a command line variable named --env with this value. Eg: /// "commands": { /// "web": "Microsoft.AspNetCore.Hosting --server Microsoft.AspNetCore.Server.WebListener - /// --server.urls http://localhost:5002 --ASPNET_ENV NtlmAuthentication", + /// --server.urls http://localhost:5002 --ASPNETCORE_ENVIRONMENT NtlmAuthentication", /// }, /// public class StartupNtlmAuthentication diff --git a/src/MusicStore/StartupOpenIdConnect.cs b/src/MusicStore/StartupOpenIdConnect.cs index a833f15d42..5c1c4a293d 100644 --- a/src/MusicStore/StartupOpenIdConnect.cs +++ b/src/MusicStore/StartupOpenIdConnect.cs @@ -13,14 +13,14 @@ namespace MusicStore /// /// To make runtime to load an environment based startup class, specify the environment by the following ways: /// 1. Drop a Microsoft.AspNetCore.Hosting.ini file in the wwwroot folder - /// 2. Add a setting in the ini file named 'ASPNET_ENV' with value of the format 'Startup[EnvironmentName]'. + /// 2. Add a setting in the ini file named 'ASPNETCORE_ENVIRONMENT' with value of the format 'Startup[EnvironmentName]'. /// For example: To load a Startup class named 'StartupOpenIdConnect' the value of the env should be - /// 'OpenIdConnect' (eg. ASPNET_ENV=OpenIdConnect). Runtime adds a 'Startup' prefix to this + /// 'OpenIdConnect' (eg. ASPNETCORE_ENVIRONMENT=OpenIdConnect). Runtime adds a 'Startup' prefix to this /// and loads 'StartupOpenIdConnect'. /// /// If no environment name is specified the default startup class loaded is 'Startup'. /// Alternative ways to specify environment are: - /// 1. Set the environment variable named SET ASPNET_ENV=OpenIdConnect + /// 1. Set the environment variable named SET ASPNETCORE_ENVIRONMENT=OpenIdConnect /// 2. For selfhost based servers pass in a command line variable named --env with this value. Eg: /// "commands": { /// "web": "Microsoft.AspNetCore.Hosting --server Microsoft.AspNetCore.Server.WebListener diff --git a/test/E2ETests/Implementation/FacebookLoginScenarios.cs b/test/E2ETests/Implementation/FacebookLoginScenarios.cs index 832d92a7f4..b06ec8a196 100644 --- a/test/E2ETests/Implementation/FacebookLoginScenarios.cs +++ b/test/E2ETests/Implementation/FacebookLoginScenarios.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Collections.Generic; using System.Net; using System.Net.Http; @@ -39,7 +40,10 @@ namespace E2ETests Assert.Equal("ValidStateData", queryItems["state"]); Assert.Equal("custom", queryItems["custom_redirect_uri"]); //Check for the correlation cookie - //Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNetCore.Correlation.Facebook")); + Assert.NotEmpty( + _httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)) + .Cast() + .Where(cookie => cookie.Name.StartsWith(".AspNetCore.Correlation.Facebook"))); //This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now. _httpClientHandler = new HttpClientHandler(); diff --git a/test/E2ETests/Implementation/GoogleLoginScenarios.cs b/test/E2ETests/Implementation/GoogleLoginScenarios.cs index 9dcb080caa..b17d451f3a 100644 --- a/test/E2ETests/Implementation/GoogleLoginScenarios.cs +++ b/test/E2ETests/Implementation/GoogleLoginScenarios.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Collections.Generic; using System.Net; using System.Net.Http; @@ -40,7 +41,10 @@ namespace E2ETests Assert.Equal("ValidStateData", queryItems["state"]); Assert.Equal("custom", queryItems["custom_redirect_uri"]); //Check for the correlation cookie - //Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNetCore.Correlation.Google")); + Assert.NotEmpty( + _httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)) + .Cast() + .Where(cookie => cookie.Name.StartsWith(".AspNetCore.Correlation.Google"))); //This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now. _httpClientHandler = new HttpClientHandler(); diff --git a/test/E2ETests/Implementation/MicrosoftAccountAuthenticationScenarios.cs b/test/E2ETests/Implementation/MicrosoftAccountAuthenticationScenarios.cs index b57dc39019..4c1308e2f9 100644 --- a/test/E2ETests/Implementation/MicrosoftAccountAuthenticationScenarios.cs +++ b/test/E2ETests/Implementation/MicrosoftAccountAuthenticationScenarios.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Collections.Generic; using System.Net; using System.Net.Http; @@ -40,7 +41,10 @@ namespace E2ETests Assert.Equal("custom", queryItems["custom_redirect_uri"]); //Check for the correlation cookie - //Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNetCore.Correlation.Microsoft")); + Assert.NotEmpty( + _httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)) + .Cast() + .Where(cookie => cookie.Name.StartsWith(".AspNetCore.Correlation.Microsoft"))); //This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now. _httpClientHandler = new HttpClientHandler();