From 1ba6608d9080af31cba3541e77ca1c8780da5734 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Fri, 5 Aug 2016 09:58:20 -0700 Subject: [PATCH] Removed 'TESTING' compiler directive --- .../Areas/Admin/Controllers/StoreManagerController.cs | 3 +-- src/MusicStore/Controllers/AccountController.cs | 3 +-- .../ForTesting/Mocks/Common/CustomStateDataFormat.cs | 2 -- src/MusicStore/ForTesting/Mocks/Common/Helpers.cs | 4 +--- .../Mocks/Facebook/FacebookMockBackChannelHttpHandler.cs | 2 -- .../ForTesting/Mocks/Facebook/TestFacebookEvents.cs | 2 -- .../Mocks/Google/GoogleMockBackChannelHttpHandler.cs | 2 -- src/MusicStore/ForTesting/Mocks/Google/TestGoogleEvents.cs | 2 -- .../MicrosoftAccountMockBackChannelHandler.cs | 2 -- .../Mocks/MicrosoftAccount/TestMicrosoftAccountEvents.cs | 2 -- .../Mocks/OpenIdConnect/CustomStringDataFormat.cs | 2 -- .../OpenIdConnect/OpenIdConnectBackChannelHttpHandler.cs | 6 ++---- .../Mocks/OpenIdConnect/TestOpenIdConnectEvents.cs | 2 -- .../ForTesting/Mocks/StartupOpenIdConnectTesting.cs | 2 -- src/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs | 2 -- .../Mocks/Twitter/CustomTwitterStateDataFormat.cs | 2 -- .../ForTesting/Mocks/Twitter/TestTwitterEvents.cs | 2 -- .../Mocks/Twitter/TwitterMockBackChannelHttpHandler.cs | 2 -- src/MusicStore/Models/SampleData.cs | 3 +-- src/MusicStore/Startup.cs | 1 - src/MusicStore/project.json | 3 +-- test/E2ETests/MusicStoreConfig.cs | 7 +------ 22 files changed, 8 insertions(+), 50 deletions(-) diff --git a/src/MusicStore/Areas/Admin/Controllers/StoreManagerController.cs b/src/MusicStore/Areas/Admin/Controllers/StoreManagerController.cs index 6ae41ca8d7..9a75e4a4ce 100644 --- a/src/MusicStore/Areas/Admin/Controllers/StoreManagerController.cs +++ b/src/MusicStore/Areas/Admin/Controllers/StoreManagerController.cs @@ -197,7 +197,7 @@ namespace MusicStore.Areas.Admin.Controllers return string.Format("album_{0}", id); } -#if TESTING + // NOTE: this is used for end to end testing only // // GET: /StoreManager/GetAlbumIdFromName // Note: Added for automated testing purpose. Application does not use this. @@ -215,6 +215,5 @@ namespace MusicStore.Areas.Admin.Controllers return Content(album.AlbumId.ToString()); } -#endif } } \ No newline at end of file diff --git a/src/MusicStore/Controllers/AccountController.cs b/src/MusicStore/Controllers/AccountController.cs index 3ab1822754..65c0c6c066 100644 --- a/src/MusicStore/Controllers/AccountController.cs +++ b/src/MusicStore/Controllers/AccountController.cs @@ -420,14 +420,13 @@ namespace MusicStore.Controllers var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user); -#if TESTING + // NOTE: Used for end to end testing only //Just for automated testing adding a claim named 'ManageStore' - Not required for production var manageClaim = info.Principal.Claims.Where(c => c.Type == "ManageStore").FirstOrDefault(); if (manageClaim != null) { await UserManager.AddClaimAsync(user, manageClaim); } -#endif if (result.Succeeded) { diff --git a/src/MusicStore/ForTesting/Mocks/Common/CustomStateDataFormat.cs b/src/MusicStore/ForTesting/Mocks/Common/CustomStateDataFormat.cs index 2054996159..39e39a38ff 100644 --- a/src/MusicStore/ForTesting/Mocks/Common/CustomStateDataFormat.cs +++ b/src/MusicStore/ForTesting/Mocks/Common/CustomStateDataFormat.cs @@ -1,4 +1,3 @@ -#if TESTING using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http.Authentication; using Newtonsoft.Json; @@ -41,4 +40,3 @@ namespace MusicStore.Mocks.Common } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/Common/Helpers.cs b/src/MusicStore/ForTesting/Mocks/Common/Helpers.cs index 98ed129194..2dfe3adaa1 100644 --- a/src/MusicStore/ForTesting/Mocks/Common/Helpers.cs +++ b/src/MusicStore/ForTesting/Mocks/Common/Helpers.cs @@ -1,5 +1,4 @@ -#if TESTING -using System; +using System; namespace MusicStore.Mocks.Common { @@ -14,4 +13,3 @@ namespace MusicStore.Mocks.Common } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/Facebook/FacebookMockBackChannelHttpHandler.cs b/src/MusicStore/ForTesting/Mocks/Facebook/FacebookMockBackChannelHttpHandler.cs index dfae13c0fa..3982964372 100644 --- a/src/MusicStore/ForTesting/Mocks/Facebook/FacebookMockBackChannelHttpHandler.cs +++ b/src/MusicStore/ForTesting/Mocks/Facebook/FacebookMockBackChannelHttpHandler.cs @@ -1,4 +1,3 @@ -#if TESTING using System; using System.Net; using System.Net.Http; @@ -56,4 +55,3 @@ namespace MusicStore.Mocks.Facebook } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/Facebook/TestFacebookEvents.cs b/src/MusicStore/ForTesting/Mocks/Facebook/TestFacebookEvents.cs index f4de6ef93a..4f07b75303 100644 --- a/src/MusicStore/ForTesting/Mocks/Facebook/TestFacebookEvents.cs +++ b/src/MusicStore/ForTesting/Mocks/Facebook/TestFacebookEvents.cs @@ -1,4 +1,3 @@ -#if TESTING using System; using System.Linq; using System.Security.Claims; @@ -55,4 +54,3 @@ namespace MusicStore.Mocks.Facebook } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/Google/GoogleMockBackChannelHttpHandler.cs b/src/MusicStore/ForTesting/Mocks/Google/GoogleMockBackChannelHttpHandler.cs index a22dabe140..f5eb4a9ead 100644 --- a/src/MusicStore/ForTesting/Mocks/Google/GoogleMockBackChannelHttpHandler.cs +++ b/src/MusicStore/ForTesting/Mocks/Google/GoogleMockBackChannelHttpHandler.cs @@ -1,4 +1,3 @@ -#if TESTING using System; using System.Net; using System.Net.Http; @@ -54,4 +53,3 @@ namespace MusicStore.Mocks.Google } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/Google/TestGoogleEvents.cs b/src/MusicStore/ForTesting/Mocks/Google/TestGoogleEvents.cs index a39381cc45..4eecf022fc 100644 --- a/src/MusicStore/ForTesting/Mocks/Google/TestGoogleEvents.cs +++ b/src/MusicStore/ForTesting/Mocks/Google/TestGoogleEvents.cs @@ -1,4 +1,3 @@ -#if TESTING using System; using System.Linq; using System.Security.Claims; @@ -55,4 +54,3 @@ namespace MusicStore.Mocks.Google } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/MicrosoftAccount/MicrosoftAccountMockBackChannelHandler.cs b/src/MusicStore/ForTesting/Mocks/MicrosoftAccount/MicrosoftAccountMockBackChannelHandler.cs index 119b6133ef..3ebf70a79c 100644 --- a/src/MusicStore/ForTesting/Mocks/MicrosoftAccount/MicrosoftAccountMockBackChannelHandler.cs +++ b/src/MusicStore/ForTesting/Mocks/MicrosoftAccount/MicrosoftAccountMockBackChannelHandler.cs @@ -1,4 +1,3 @@ -#if TESTING using System; using System.Net; using System.Net.Http; @@ -55,4 +54,3 @@ namespace MusicStore.Mocks.MicrosoftAccount } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/MicrosoftAccount/TestMicrosoftAccountEvents.cs b/src/MusicStore/ForTesting/Mocks/MicrosoftAccount/TestMicrosoftAccountEvents.cs index 641d59ad2d..ffcf018fe4 100644 --- a/src/MusicStore/ForTesting/Mocks/MicrosoftAccount/TestMicrosoftAccountEvents.cs +++ b/src/MusicStore/ForTesting/Mocks/MicrosoftAccount/TestMicrosoftAccountEvents.cs @@ -1,4 +1,3 @@ -#if TESTING using System; using System.Linq; using System.Security.Claims; @@ -56,4 +55,3 @@ namespace MusicStore.Mocks.MicrosoftAccount } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/OpenIdConnect/CustomStringDataFormat.cs b/src/MusicStore/ForTesting/Mocks/OpenIdConnect/CustomStringDataFormat.cs index cea911f1d3..dc433f9625 100644 --- a/src/MusicStore/ForTesting/Mocks/OpenIdConnect/CustomStringDataFormat.cs +++ b/src/MusicStore/ForTesting/Mocks/OpenIdConnect/CustomStringDataFormat.cs @@ -1,4 +1,3 @@ -#if TESTING using Microsoft.AspNetCore.Authentication; namespace MusicStore.Mocks.OpenIdConnect @@ -28,4 +27,3 @@ namespace MusicStore.Mocks.OpenIdConnect } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/OpenIdConnect/OpenIdConnectBackChannelHttpHandler.cs b/src/MusicStore/ForTesting/Mocks/OpenIdConnect/OpenIdConnectBackChannelHttpHandler.cs index a8dd616713..a8e9c0c9b4 100644 --- a/src/MusicStore/ForTesting/Mocks/OpenIdConnect/OpenIdConnectBackChannelHttpHandler.cs +++ b/src/MusicStore/ForTesting/Mocks/OpenIdConnect/OpenIdConnectBackChannelHttpHandler.cs @@ -1,5 +1,4 @@ -#if TESTING -using System.IO; +using System.IO; using System.Net.Http; using System.Threading; using System.Threading.Tasks; @@ -13,7 +12,7 @@ namespace MusicStore.Mocks.OpenIdConnect var response = new HttpResponseMessage(); var basePath = Path.GetFullPath(Path.Combine( - Directory.GetCurrentDirectory(), "ForTesting", "Mocks","OpenIdConnect")); + Directory.GetCurrentDirectory(), "ForTesting", "Mocks", "OpenIdConnect")); if (request.RequestUri.AbsoluteUri == "https://login.windows.net/[tenantName].onmicrosoft.com/.well-known/openid-configuration") { @@ -32,4 +31,3 @@ namespace MusicStore.Mocks.OpenIdConnect } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/OpenIdConnect/TestOpenIdConnectEvents.cs b/src/MusicStore/ForTesting/Mocks/OpenIdConnect/TestOpenIdConnectEvents.cs index 44b236b3d5..c17219d11a 100644 --- a/src/MusicStore/ForTesting/Mocks/OpenIdConnect/TestOpenIdConnectEvents.cs +++ b/src/MusicStore/ForTesting/Mocks/OpenIdConnect/TestOpenIdConnectEvents.cs @@ -1,4 +1,3 @@ -#if TESTING using System.Collections.Generic; using System.Security.Claims; using System.Threading.Tasks; @@ -62,4 +61,3 @@ namespace MusicStore.Mocks.OpenIdConnect } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs b/src/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs index f2875fcaca..94aea3494b 100644 --- a/src/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs +++ b/src/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs @@ -1,4 +1,3 @@ -#if TESTING using System; using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.AspNetCore.Authorization; @@ -156,4 +155,3 @@ namespace MusicStore } } } -#endif diff --git a/src/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs b/src/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs index 1abca4d8b7..144f138237 100644 --- a/src/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs +++ b/src/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs @@ -1,4 +1,3 @@ -#if TESTING using System; using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Authentication.Twitter; @@ -200,4 +199,3 @@ namespace MusicStore } } } -#endif diff --git a/src/MusicStore/ForTesting/Mocks/Twitter/CustomTwitterStateDataFormat.cs b/src/MusicStore/ForTesting/Mocks/Twitter/CustomTwitterStateDataFormat.cs index 0c39e3c0d4..422ae29344 100644 --- a/src/MusicStore/ForTesting/Mocks/Twitter/CustomTwitterStateDataFormat.cs +++ b/src/MusicStore/ForTesting/Mocks/Twitter/CustomTwitterStateDataFormat.cs @@ -1,4 +1,3 @@ -#if TESTING using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Twitter; using Newtonsoft.Json; @@ -45,4 +44,3 @@ namespace MusicStore.Mocks.Twitter } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/Twitter/TestTwitterEvents.cs b/src/MusicStore/ForTesting/Mocks/Twitter/TestTwitterEvents.cs index 414a7a8ebd..e5379c2a6a 100644 --- a/src/MusicStore/ForTesting/Mocks/Twitter/TestTwitterEvents.cs +++ b/src/MusicStore/ForTesting/Mocks/Twitter/TestTwitterEvents.cs @@ -1,4 +1,3 @@ -#if TESTING using System.Linq; using System.Security.Claims; using System.Threading.Tasks; @@ -49,4 +48,3 @@ namespace MusicStore.Mocks.Twitter } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/ForTesting/Mocks/Twitter/TwitterMockBackChannelHttpHandler.cs b/src/MusicStore/ForTesting/Mocks/Twitter/TwitterMockBackChannelHttpHandler.cs index 9a8074bf27..2ae3194969 100644 --- a/src/MusicStore/ForTesting/Mocks/Twitter/TwitterMockBackChannelHttpHandler.cs +++ b/src/MusicStore/ForTesting/Mocks/Twitter/TwitterMockBackChannelHttpHandler.cs @@ -1,4 +1,3 @@ -#if TESTING using System; using System.Collections.Generic; using System.Net; @@ -66,4 +65,3 @@ namespace MusicStore.Mocks.Twitter } } } -#endif \ No newline at end of file diff --git a/src/MusicStore/Models/SampleData.cs b/src/MusicStore/Models/SampleData.cs index 7f726c7c03..dc0bf04123 100644 --- a/src/MusicStore/Models/SampleData.cs +++ b/src/MusicStore/Models/SampleData.cs @@ -105,7 +105,7 @@ namespace MusicStore.Models await userManager.AddClaimAsync(user, new Claim("ManageStore", "Allowed")); } -#if TESTING + // NOTE: For end to end testing only var envPerfLab = configuration["PERF_LAB"]; if (envPerfLab == "true") { @@ -119,7 +119,6 @@ namespace MusicStore.Models } } } -#endif } private static Album[] GetAlbums(string imgUrl, Dictionary genres, Dictionary artists) diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index 64f5e5728a..6acb577bc1 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -5,7 +5,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Console; using MusicStore.Components; using MusicStore.Models; diff --git a/src/MusicStore/project.json b/src/MusicStore/project.json index f239ad9c48..7169ded7e4 100644 --- a/src/MusicStore/project.json +++ b/src/MusicStore/project.json @@ -16,8 +16,7 @@ ] }, "define": [ - "DEMO", - "TESTING" + "DEMO" ], "emitEntryPoint": true, "preserveCompilationContext": true, diff --git a/test/E2ETests/MusicStoreConfig.cs b/test/E2ETests/MusicStoreConfig.cs index 8090b19a22..a6217816da 100644 --- a/test/E2ETests/MusicStoreConfig.cs +++ b/test/E2ETests/MusicStoreConfig.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace E2ETests +namespace E2ETests { public class MusicStoreConfig {