diff --git a/Mvc.sln b/Mvc.sln
index 0f2d1a146b..8b81ab0f60 100644
--- a/Mvc.sln
+++ b/Mvc.sln
@@ -24,8 +24,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Fu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicWebSite", "test\WebSites\BasicWebSite\BasicWebSite.csproj", "{34DF1487-12C6-476C-BE0A-F31DF1939AE5}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.TestConfiguration", "test\WebSites\Microsoft.AspNetCore.Mvc.TestConfiguration\Microsoft.AspNetCore.Mvc.TestConfiguration.csproj", "{680D75ED-601F-4D86-B01B-1072D0C31B8C}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RoutingWebSite", "test\WebSites\RoutingWebSite\RoutingWebSite.csproj", "{42CDBF4A-E238-4C0F-A416-44588363EB4C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Test", "test\Microsoft.AspNetCore.Mvc.Test\Microsoft.AspNetCore.Mvc.Test.csproj", "{5F945B82-FE5F-425C-956C-8BC2F2020254}"
@@ -124,8 +122,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Pe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Testing", "src\Microsoft.AspNetCore.Mvc.Testing\Microsoft.AspNetCore.Mvc.Testing.csproj", "{7500B228-1769-4CFB-A571-3DFAC6678A06}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Mvc.Testing.Xunit", "src\Microsoft.AspNetCore.Mvc.Testing.Xunit\Microsoft.AspNetCore.Mvc.Testing.Xunit.csproj", "{5248D809-E5E5-49FE-B3E8-428D454C63B3}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -206,16 +202,6 @@ Global
{34DF1487-12C6-476C-BE0A-F31DF1939AE5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{34DF1487-12C6-476C-BE0A-F31DF1939AE5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{34DF1487-12C6-476C-BE0A-F31DF1939AE5}.Release|x86.ActiveCfg = Release|Any CPU
- {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Debug|x86.ActiveCfg = Debug|Any CPU
- {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Release|Any CPU.Build.0 = Release|Any CPU
- {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {680D75ED-601F-4D86-B01B-1072D0C31B8C}.Release|x86.ActiveCfg = Release|Any CPU
{42CDBF4A-E238-4C0F-A416-44588363EB4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42CDBF4A-E238-4C0F-A416-44588363EB4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42CDBF4A-E238-4C0F-A416-44588363EB4C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -772,18 +758,6 @@ Global
{7500B228-1769-4CFB-A571-3DFAC6678A06}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{7500B228-1769-4CFB-A571-3DFAC6678A06}.Release|x86.ActiveCfg = Release|Any CPU
{7500B228-1769-4CFB-A571-3DFAC6678A06}.Release|x86.Build.0 = Release|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Debug|x86.Build.0 = Debug|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Release|Any CPU.Build.0 = Release|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Release|x86.ActiveCfg = Release|Any CPU
- {5248D809-E5E5-49FE-B3E8-428D454C63B3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -797,7 +771,6 @@ Global
{16703B76-C9F7-4C75-AE6C-53D92E308E3C} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{323D0C04-B518-4A8F-8A8E-3546AD153D34} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{34DF1487-12C6-476C-BE0A-F31DF1939AE5} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
- {680D75ED-601F-4D86-B01B-1072D0C31B8C} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{42CDBF4A-E238-4C0F-A416-44588363EB4C} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{5F945B82-FE5F-425C-956C-8BC2F2020254} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{B07CAF59-11ED-40E3-A5DB-E1178F84FA78} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
@@ -847,7 +820,6 @@ Global
{4BA6EC9A-B6D9-41F2-BFDA-D82B22D80352} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{F16CEE0D-A28E-43BD-802F-99BAFE4BA7CE} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
{7500B228-1769-4CFB-A571-3DFAC6678A06} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
- {5248D809-E5E5-49FE-B3E8-428D454C63B3} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {63D344F6-F86D-40E6-85B9-0AABBE338C4A}
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/CultureReplacer.cs b/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/CultureReplacer.cs
deleted file mode 100644
index 75d60d3ace..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/CultureReplacer.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Globalization;
-using System.Threading;
-
-namespace Microsoft.AspNetCore.Mvc.Testing.Xunit.Internal
-{
- internal class CultureReplacer : IDisposable
- {
- private const string _defaultCultureName = "en-GB";
- private const string _defaultUICultureName = "en-US";
- private static readonly CultureInfo _defaultCulture = new CultureInfo(_defaultCultureName);
- private readonly CultureInfo _originalCulture;
- private readonly CultureInfo _originalUICulture;
- private readonly long _threadId;
-
- // Culture => Formatting of dates/times/money/etc, defaults to en-GB because en-US is the same as InvariantCulture
- // We want to be able to find issues where the InvariantCulture is used, but a specific culture should be.
- //
- // UICulture => Language
- public CultureReplacer(string culture = _defaultCultureName, string uiCulture = _defaultUICultureName)
- : this(new CultureInfo(culture), new CultureInfo(uiCulture))
- {
- }
-
- public CultureReplacer(CultureInfo culture, CultureInfo uiCulture)
- {
- _originalCulture = CultureInfo.CurrentCulture;
- _originalUICulture = CultureInfo.CurrentUICulture;
- _threadId = Thread.CurrentThread.ManagedThreadId;
- CultureInfo.CurrentCulture = culture;
- CultureInfo.CurrentUICulture = uiCulture;
- }
-
- ///
- /// The name of the culture that is used as the default value for CultureInfo.DefaultThreadCurrentCulture when CultureReplacer is used.
- ///
- public static string DefaultCultureName
- {
- get { return _defaultCultureName; }
- }
-
- ///
- /// The name of the culture that is used as the default value for [Thread.CurrentThread(NET45)/CultureInfo(K10)].CurrentUICulture when CultureReplacer is used.
- ///
- public static string DefaultUICultureName
- {
- get { return _defaultUICultureName; }
- }
-
- ///
- /// The culture that is used as the default value for [Thread.CurrentThread(NET45)/CultureInfo(K10)].CurrentCulture when CultureReplacer is used.
- ///
- public static CultureInfo DefaultCulture
- {
- get { return _defaultCulture; }
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- private void Dispose(bool disposing)
- {
- if (disposing)
- {
- if(Thread.CurrentThread.ManagedThreadId != _threadId)
- {
- throw new InvalidOperationException("The current thread is not the same as the thread " +
- "invoking the constructor. This should never happen.");
- }
-
- CultureInfo.CurrentCulture = _originalCulture;
- CultureInfo.CurrentUICulture = _originalUICulture;
- }
- }
- }
-}
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/CultureReplacerMiddleware.cs b/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/CultureReplacerMiddleware.cs
deleted file mode 100644
index 64408bb787..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/CultureReplacerMiddleware.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
-
-namespace Microsoft.AspNetCore.Mvc.Testing.Xunit.Internal
-{
- ///
- /// A middleware that ensures web sites run in a consistent culture. Currently useful for tests that format dates,
- /// times, or numbers. Will be more useful when we have localized resources.
- ///
- public class CultureReplacerMiddleware
- {
- // Have no current need to use cultures other than the ReplaceCultureAttribute defaults (en-GB, en-US).
- private readonly ReplaceCultureAttribute _replaceCulture = new ReplaceCultureAttribute();
-
- private readonly RequestDelegate _next;
-
- public CultureReplacerMiddleware(RequestDelegate next)
- {
- _next = next;
- }
-
- public async Task Invoke(HttpContext context)
- {
- // Use ReplaceCultureAttribute to avoid thread consistency checks in CultureReplacer. await doesn't
- // necessarily end on the original thread. For this case, problems arise when next middleware throws. Can
- // remove the thread consistency checks once culture is (at least for .NET 4.6) handled using
- // AsyncLocal.
- try
- {
- _replaceCulture.Before(methodUnderTest: null);
- await _next(context);
- }
- finally
- {
- _replaceCulture.After(methodUnderTest: null);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/ReplaceCultureAttribute.cs b/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/ReplaceCultureAttribute.cs
deleted file mode 100644
index c7914127e7..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/ReplaceCultureAttribute.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Globalization;
-using System.Reflection;
-using Xunit.Sdk;
-
-namespace Microsoft.AspNetCore.Mvc.Testing.Xunit.Internal
-{
- ///
- /// Replaces the current culture and UI culture for the test.
- ///
- [AttributeUsage(AttributeTargets.Method)]
- internal class ReplaceCultureAttribute : BeforeAfterTestAttribute
- {
- private const string _defaultCultureName = "en-GB";
- private const string _defaultUICultureName = "en-US";
- private CultureInfo _originalCulture;
- private CultureInfo _originalUICulture;
-
- ///
- /// Replaces the current culture and UI culture to en-GB and en-US respectively.
- ///
- public ReplaceCultureAttribute() :
- this(_defaultCultureName, _defaultUICultureName)
- {
- }
-
- ///
- /// Replaces the current culture and UI culture based on specified values.
- ///
- public ReplaceCultureAttribute(string currentCulture, string currentUICulture)
- {
- Culture = new CultureInfo(currentCulture);
- UICulture = new CultureInfo(currentUICulture);
- }
-
- ///
- /// The for the test. Defaults to en-GB.
- ///
- ///
- /// en-GB is used here as the default because en-US is equivalent to the InvariantCulture. We
- /// want to be able to find bugs where we're accidentally relying on the Invariant instead of the
- /// user's culture.
- ///
- public CultureInfo Culture { get; }
-
- ///
- /// The for the test. Defaults to en-US.
- ///
- public CultureInfo UICulture { get; }
-
- public override void Before(MethodInfo methodUnderTest)
- {
- _originalCulture = CultureInfo.CurrentCulture;
- _originalUICulture = CultureInfo.CurrentUICulture;
-
- CultureInfo.CurrentCulture = Culture;
- CultureInfo.CurrentUICulture = UICulture;
- }
-
- public override void After(MethodInfo methodUnderTest)
- {
- CultureInfo.CurrentCulture = _originalCulture;
- CultureInfo.CurrentUICulture = _originalUICulture;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Microsoft.AspNetCore.Mvc.Testing.Xunit.csproj b/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Microsoft.AspNetCore.Mvc.Testing.Xunit.csproj
deleted file mode 100644
index b476a2dda5..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Microsoft.AspNetCore.Mvc.Testing.Xunit.csproj
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
- XUnit convenience fixture for creating functional tests for MVC applications.
- netstandard2.0
- $(NoWarn);CS1591
- true
- aspnetcore;aspnetcoremvc;aspnetcoremvctesting
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Testing.Xunit.targets b/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Testing.Xunit.targets
deleted file mode 100644
index 2f8351755d..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/build/netstandard2.0/Microsoft.AspNetCore.Mvc.Testing.Xunit.targets
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
- true
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing/Internal/CookieContainerHandler.cs b/src/Microsoft.AspNetCore.Mvc.Testing/Internal/CookieContainerHandler.cs
deleted file mode 100644
index edcaa857c1..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Testing/Internal/CookieContainerHandler.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Net;
-using System.Net.Http;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Microsoft.AspNetCore.Mvc.Testing.Internal
-{
- ///
- /// Delegating handler for managing cookies on functional tests.
- ///
- public class CookieContainerHandler : DelegatingHandler
- {
- public CookieContainerHandler(HttpMessageHandler innerHandler)
- : base(innerHandler)
- {
- }
-
- public CookieContainer Container { get; } = new CookieContainer();
-
- protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
- {
- var cookieHeader = Container.GetCookieHeader(request.RequestUri);
- request.Headers.Add("Cookie", cookieHeader);
-
- var response = await base.SendAsync(request, cancellationToken);
-
- if (response.Headers.TryGetValues("Set-Cookie", out var setCookieHeaders))
- {
- foreach (var header in setCookieHeaders)
- {
- Container.SetCookies(response.RequestMessage.RequestUri, header);
- }
- }
-
- return response;
- }
- }
-}
\ No newline at end of file
diff --git a/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/CultureReplacerMiddleware.cs b/src/Microsoft.AspNetCore.Mvc.Testing/Internal/CultureReplacerMiddleware.cs
similarity index 58%
rename from test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/CultureReplacerMiddleware.cs
rename to src/Microsoft.AspNetCore.Mvc.Testing/Internal/CultureReplacerMiddleware.cs
index c296902bc3..8e8cf8d19c 100644
--- a/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/CultureReplacerMiddleware.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Testing/Internal/CultureReplacerMiddleware.cs
@@ -1,12 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System.Globalization;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Testing;
-namespace Microsoft.AspNetCore.Mvc.TestConfiguration
+namespace Microsoft.AspNetCore.Mvc.Testing.Internal
{
///
/// A middleware that ensures web sites run in a consistent culture. Currently useful for tests that format dates,
@@ -14,16 +13,21 @@ namespace Microsoft.AspNetCore.Mvc.TestConfiguration
///
public class CultureReplacerMiddleware
{
- // Have no current need to use cultures other than the ReplaceCultureAttribute defaults (en-GB, en-US).
- private readonly ReplaceCultureAttribute _replaceCulture = new ReplaceCultureAttribute();
-
private readonly RequestDelegate _next;
- public CultureReplacerMiddleware(RequestDelegate next)
+ private CultureInfo _originalCulture;
+ private CultureInfo _originalUICulture;
+
+ public CultureReplacerMiddleware(RequestDelegate next, TestCulture culture)
{
+ Culture = new CultureInfo(culture.Culture);
+ UICulture = new CultureInfo(culture.UICulture);
_next = next;
}
+ public CultureInfo UICulture { get; }
+ public CultureInfo Culture { get; }
+
public async Task Invoke(HttpContext context)
{
// Use ReplaceCultureAttribute to avoid thread consistency checks in CultureReplacer. await doesn't
@@ -32,12 +36,18 @@ namespace Microsoft.AspNetCore.Mvc.TestConfiguration
// AsyncLocal.
try
{
- _replaceCulture.Before(methodUnderTest: null);
+ _originalCulture = CultureInfo.CurrentCulture;
+ _originalUICulture = CultureInfo.CurrentUICulture;
+
+ CultureInfo.CurrentCulture = Culture;
+ CultureInfo.CurrentUICulture = UICulture;
+
await _next(context);
}
finally
{
- _replaceCulture.After(methodUnderTest: null);
+ CultureInfo.CurrentCulture = _originalCulture;
+ CultureInfo.CurrentUICulture = _originalUICulture;
}
}
}
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/CultureReplacerStartupFilter.cs b/src/Microsoft.AspNetCore.Mvc.Testing/Internal/CultureReplacerStartupFilter.cs
similarity index 93%
rename from src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/CultureReplacerStartupFilter.cs
rename to src/Microsoft.AspNetCore.Mvc.Testing/Internal/CultureReplacerStartupFilter.cs
index caa71a337f..bb63e6adf1 100644
--- a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/Internal/CultureReplacerStartupFilter.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Testing/Internal/CultureReplacerStartupFilter.cs
@@ -5,7 +5,7 @@ using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
-namespace Microsoft.AspNetCore.Mvc.Testing.Xunit.Internal
+namespace Microsoft.AspNetCore.Mvc.Testing.Internal
{
///
/// Inserts the at the beginning of the pipeline.
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing/Internal/TestCulture.cs b/src/Microsoft.AspNetCore.Mvc.Testing/Internal/TestCulture.cs
new file mode 100644
index 0000000000..7c0be08210
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Mvc.Testing/Internal/TestCulture.cs
@@ -0,0 +1,11 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+namespace Microsoft.AspNetCore.Mvc.Testing.Internal
+{
+ public class TestCulture
+ {
+ public string Culture { get; set; }
+ public string UICulture { get; set; }
+ }
+}
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing/MvcWebApplicationBuilder.cs b/src/Microsoft.AspNetCore.Mvc.Testing/MvcWebApplicationBuilder.cs
index b06729601e..a2837bc9c4 100644
--- a/src/Microsoft.AspNetCore.Mvc.Testing/MvcWebApplicationBuilder.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Testing/MvcWebApplicationBuilder.cs
@@ -3,15 +3,18 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Testing.Internal;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Microsoft.AspNetCore.Mvc.Testing
{
@@ -21,6 +24,8 @@ namespace Microsoft.AspNetCore.Mvc.Testing
/// The application startup class.
public class MvcWebApplicationBuilder where TStartup : class
{
+ private TestCulture _systemCulture;
+
public string ContentRoot { get; set; }
public IList> ConfigureServicesBeforeStartup { get; set; } = new List>();
public IList> ConfigureServicesAfterStartup { get; set; } = new List>();
@@ -56,13 +61,17 @@ namespace Microsoft.AspNetCore.Mvc.Testing
public MvcWebApplicationBuilder UseApplicationAssemblies()
{
var depsFileName = $"{typeof(TStartup).Assembly.GetName().Name}.deps.json";
- var depsFile = new FileInfo(Path.Combine(Directory.GetCurrentDirectory(), depsFileName));
+ var depsFile = new FileInfo(Path.Combine(AppContext.BaseDirectory, depsFileName));
if (!depsFile.Exists)
{
- throw new InvalidOperationException($"Can't find'{depsFile}'. This file is required for functional tests " +
- $"to run properly. There should be a copy of the file on your source project bin folder. If thats not the " +
- $"case, make sure that the property PreserveCompilationContext is set to true on your project file. E.g" +
- $"'true'.");
+ throw new InvalidOperationException($"Can't find'{depsFile.FullName}'. This file is required for functional tests " +
+ "to run properly. There should be a copy of the file on your source project bin folder. If thats not the " +
+ "case, make sure that the property PreserveCompilationContext is set to true on your project file. E.g" +
+ "'true'." +
+ $"For functional tests to work they need to either run from the build output folder or the {Path.GetFileName(depsFile.FullName)} " +
+ $"file from your application's output directory must be copied" +
+ "to the folder where the tests are running on. A common cause for this error is having shadow copying enabled when the" +
+ "tests run.");
}
ApplicationAssemblies.AddRange(DefaultAssemblyPartDiscoveryProvider
@@ -73,6 +82,44 @@ namespace Microsoft.AspNetCore.Mvc.Testing
return this;
}
+ ///
+ /// Sets up an that configures the at the
+ /// beginning of the pipeline to change the and
+ /// of the thread so that they match the cultures in and for the rest of the
+ /// .
+ ///
+ /// The culture to use when processing .
+ /// The UI culture to use when processing .
+ /// An instance of this
+ public MvcWebApplicationBuilder UseRequestCulture(string culture, string uiCulture)
+ {
+ ConfigureBeforeStartup(services =>
+ {
+ services.TryAddSingleton(new TestCulture
+ {
+ Culture = culture,
+ UICulture = uiCulture
+ });
+ services.TryAddSingleton();
+ });
+
+ return this;
+ }
+
+ ///
+ /// Overrides the and the
+ /// of the system during the initial configuration of the in case there is any middleware
+ /// that captures the current culture of the system when the pipeline is being constructed.
+ ///
+ /// The culture to use when processing .
+ /// The UI culture to use when processing .
+ /// An instance of this
+ public MvcWebApplicationBuilder UseStartupCulture(string culture, string uiCulture)
+ {
+ _systemCulture = new TestCulture { Culture = culture, UICulture = uiCulture };
+ return this;
+ }
+
///
/// Configures the application content root.
///
@@ -113,7 +160,19 @@ namespace Microsoft.AspNetCore.Mvc.Testing
.UseContentRoot(ContentRoot)
.ConfigureServices(InitializeServices);
- return new TestServer(builder);
+ var originalCulture = CultureInfo.CurrentCulture;
+ var originalUICulture = CultureInfo.CurrentUICulture;
+ try
+ {
+ CultureInfo.CurrentCulture = new CultureInfo(_systemCulture.Culture);
+ CultureInfo.CurrentUICulture = new CultureInfo(_systemCulture.UICulture);
+ return new TestServer(builder);
+ }
+ finally
+ {
+ CultureInfo.CurrentCulture = originalCulture;
+ CultureInfo.CurrentUICulture = originalUICulture;
+ }
}
protected virtual void InitializeServices(IServiceCollection services)
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/WebApplicationTestFixture.cs b/src/Microsoft.AspNetCore.Mvc.Testing/WebApplicationTestFixture.cs
similarity index 69%
rename from src/Microsoft.AspNetCore.Mvc.Testing.Xunit/WebApplicationTestFixture.cs
rename to src/Microsoft.AspNetCore.Mvc.Testing/WebApplicationTestFixture.cs
index 6ebc54b642..2495a7824a 100644
--- a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/WebApplicationTestFixture.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Testing/WebApplicationTestFixture.cs
@@ -6,18 +6,15 @@ using System.IO;
using System.Net.Http;
using System.Reflection;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Mvc.Testing;
-using Microsoft.AspNetCore.Mvc.Testing.Xunit.Internal;
+using Microsoft.AspNetCore.Mvc.Testing.Internal;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-namespace Microsoft.AspNetCore.Mvc.FunctionalTests
+namespace Microsoft.AspNetCore.Mvc.Testing
{
///
- /// XUnit fixture for bootstrapping an application in memory for functional end to end tests.
+ /// Fixture for bootstrapping an application in memory for functional end to end tests.
///
/// The applications startup class.
public class WebApplicationTestFixture : IDisposable where TStartup : class
@@ -43,30 +40,12 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
var projectPath = Path.Combine(solutionRelativePath, projectName);
var builder = new MvcWebApplicationBuilder()
.UseSolutionRelativeContentRoot(projectPath)
- .UseApplicationAssemblies();
+ .UseApplicationAssemblies()
+ .UseRequestCulture("en-GB", "en-US")
+ .UseStartupCulture("en-GB", "en-US");
ConfigureApplication(builder);
-
- var xunitRunnerJson = new FileInfo(Path.Combine(Directory.GetCurrentDirectory(), "xunit.runner.json"));
- if (!xunitRunnerJson.Exists)
- {
- Console.WriteLine("Can't find xunit.runner.json. " +
- "Functional tests require '\"shadowCopy\": false' to work properly. " +
- "Make sure your XUnit configuration has that setup.");
- }
-
- var content = JsonConvert.DeserializeObject(File.ReadAllText(xunitRunnerJson.FullName));
- if (!content.TryGetValue("shadowCopy", out var token) || !(bool)token)
- {
- Console.WriteLine("'shadowCopy' is not set to true on xunit.runner.json. " +
- "Functional tests require '\"shadowCopy\": false' to work properly. " +
- "Make sure your XUnit configuration has that setup.");
- }
-
- using (new CultureReplacer())
- {
- _server = builder.Build();
- }
+ _server = builder.Build();
Client = _server.CreateClient();
Client.BaseAddress = new Uri("http://localhost");
@@ -81,8 +60,16 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
builder.ConfigureAfterStartup(s => s.TryAddEnumerable(ServiceDescriptor.Transient()));
}
+ ///
+ /// Gets an instance of the used to send to the server.
+ ///
public HttpClient Client { get; }
+ ///
+ /// Creates a new instance of an that can be used to
+ /// send to the server.
+ ///
+ /// The
public HttpClient CreateClient()
{
var client = _server.CreateClient();
@@ -91,9 +78,17 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
return client;
}
+ ///
+ /// Creates a new instance of an that can be used to
+ /// send to the server.
+ ///
+ /// The base address of the instance.
+ /// A list of instances to setup on the
+ /// .
+ /// The .
public HttpClient CreateClient(Uri baseAddress, params DelegatingHandler[] handlers)
{
- if (handlers.Length == 0)
+ if (handlers == null || handlers.Length == 0)
{
var client = _server.CreateClient();
client.BaseAddress = baseAddress;
@@ -117,6 +112,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
}
}
+ ///
public void Dispose()
{
Client.Dispose();
diff --git a/test/WebSites/FiltersWebSite/ExceptionInfo.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ExceptionInfo.cs
similarity index 89%
rename from test/WebSites/FiltersWebSite/ExceptionInfo.cs
rename to test/Microsoft.AspNetCore.Mvc.FunctionalTests/ExceptionInfo.cs
index 00f13a41b8..163fb82133 100644
--- a/test/WebSites/FiltersWebSite/ExceptionInfo.cs
+++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/ExceptionInfo.cs
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-namespace FiltersWebSite
+namespace Microsoft.AspNetCore.Mvc.FunctionalTests
{
///
/// Information about an exception that occurred on the server side of a functional
diff --git a/test/WebSites/FiltersWebSite/HttpResponseMessageExceptions.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/HttpResponseMessageExceptions.cs
similarity index 95%
rename from test/WebSites/FiltersWebSite/HttpResponseMessageExceptions.cs
rename to test/Microsoft.AspNetCore.Mvc.FunctionalTests/HttpResponseMessageExceptions.cs
index c5447eb2ce..d871cde089 100644
--- a/test/WebSites/FiltersWebSite/HttpResponseMessageExceptions.cs
+++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/HttpResponseMessageExceptions.cs
@@ -4,10 +4,11 @@
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
+using FiltersWebSite;
using Xunit;
using Xunit.Sdk;
-namespace FiltersWebSite
+namespace Microsoft.AspNetCore.Mvc.FunctionalTests
{
public static class HttpResponseMessageExceptions
{
diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj
index c2a91030ac..f97fc35cbd 100644
--- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj
+++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj
@@ -1,7 +1,6 @@
-
netcoreapp2.0;net461
@@ -18,10 +17,11 @@
+
-
+
@@ -55,5 +55,4 @@
-
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing.Xunit/build/netstandard2.0/xunit.runner.json b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/xunit.runner.json
similarity index 100%
rename from src/Microsoft.AspNetCore.Mvc.Testing.Xunit/build/netstandard2.0/xunit.runner.json
rename to test/Microsoft.AspNetCore.Mvc.FunctionalTests/xunit.runner.json
diff --git a/test/WebSites/ApiExplorerWebSite/ApiExplorerWebSite.csproj b/test/WebSites/ApiExplorerWebSite/ApiExplorerWebSite.csproj
index 347d0f902c..c317e7be10 100644
--- a/test/WebSites/ApiExplorerWebSite/ApiExplorerWebSite.csproj
+++ b/test/WebSites/ApiExplorerWebSite/ApiExplorerWebSite.csproj
@@ -9,7 +9,6 @@
-
diff --git a/test/WebSites/ApiExplorerWebSite/Startup.cs b/test/WebSites/ApiExplorerWebSite/Startup.cs
index 5d53827bcb..e73c55fc87 100644
--- a/test/WebSites/ApiExplorerWebSite/Startup.cs
+++ b/test/WebSites/ApiExplorerWebSite/Startup.cs
@@ -43,8 +43,6 @@ namespace ApiExplorerWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvc(routes =>
{
routes.MapRoute("default", "{controller}/{action}");
diff --git a/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj b/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj
index 888f6267fc..c46bbf9fe7 100644
--- a/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj
+++ b/test/WebSites/ApplicationModelWebSite/ApplicationModelWebSite.csproj
@@ -8,7 +8,6 @@
-
diff --git a/test/WebSites/ApplicationModelWebSite/Startup.cs b/test/WebSites/ApplicationModelWebSite/Startup.cs
index cee0fb4ee5..22a314cc26 100644
--- a/test/WebSites/ApplicationModelWebSite/Startup.cs
+++ b/test/WebSites/ApplicationModelWebSite/Startup.cs
@@ -23,8 +23,6 @@ namespace ApplicationModelWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvc(routes =>
{
routes.MapRoute(
diff --git a/test/WebSites/BasicWebSite/BasicWebSite.csproj b/test/WebSites/BasicWebSite/BasicWebSite.csproj
index 7df18281ad..66d3cd330f 100644
--- a/test/WebSites/BasicWebSite/BasicWebSite.csproj
+++ b/test/WebSites/BasicWebSite/BasicWebSite.csproj
@@ -9,7 +9,6 @@
-
diff --git a/test/WebSites/BasicWebSite/Startup.cs b/test/WebSites/BasicWebSite/Startup.cs
index 83bd6dd7ff..2ee9f6f816 100644
--- a/test/WebSites/BasicWebSite/Startup.cs
+++ b/test/WebSites/BasicWebSite/Startup.cs
@@ -28,8 +28,6 @@ namespace BasicWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseStaticFiles();
// Initializes the RequestId service for each request
diff --git a/test/WebSites/BasicWebSite/StartupWithSessionTempDataProvider.cs b/test/WebSites/BasicWebSite/StartupWithSessionTempDataProvider.cs
index 289a99a2b7..6500601f0d 100644
--- a/test/WebSites/BasicWebSite/StartupWithSessionTempDataProvider.cs
+++ b/test/WebSites/BasicWebSite/StartupWithSessionTempDataProvider.cs
@@ -19,7 +19,6 @@ namespace BasicWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
app.UseSession();
app.UseMvcWithDefaultRoute();
}
diff --git a/test/WebSites/ControllersFromServicesWebSite/ControllersFromServicesWebSite.csproj b/test/WebSites/ControllersFromServicesWebSite/ControllersFromServicesWebSite.csproj
index 8802766c15..85b453b01f 100644
--- a/test/WebSites/ControllersFromServicesWebSite/ControllersFromServicesWebSite.csproj
+++ b/test/WebSites/ControllersFromServicesWebSite/ControllersFromServicesWebSite.csproj
@@ -9,7 +9,6 @@
-
diff --git a/test/WebSites/ControllersFromServicesWebSite/Startup.cs b/test/WebSites/ControllersFromServicesWebSite/Startup.cs
index 32441f5a42..dec9bcf651 100644
--- a/test/WebSites/ControllersFromServicesWebSite/Startup.cs
+++ b/test/WebSites/ControllersFromServicesWebSite/Startup.cs
@@ -57,8 +57,6 @@ namespace ControllersFromServicesWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvc(routes =>
{
routes.MapRoute("default", "{controller}/{action}/{id}");
diff --git a/test/WebSites/CorsWebSite/CorsWebSite.csproj b/test/WebSites/CorsWebSite/CorsWebSite.csproj
index b64cc19020..3b313d4e52 100644
--- a/test/WebSites/CorsWebSite/CorsWebSite.csproj
+++ b/test/WebSites/CorsWebSite/CorsWebSite.csproj
@@ -9,7 +9,6 @@
-
diff --git a/test/WebSites/CorsWebSite/Startup.cs b/test/WebSites/CorsWebSite/Startup.cs
index 85cd89acd3..73cbbd4b1e 100644
--- a/test/WebSites/CorsWebSite/Startup.cs
+++ b/test/WebSites/CorsWebSite/Startup.cs
@@ -74,8 +74,6 @@ namespace CorsWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvc();
}
diff --git a/test/WebSites/ErrorPageMiddlewareWebSite/ErrorPageMiddlewareWebSite.csproj b/test/WebSites/ErrorPageMiddlewareWebSite/ErrorPageMiddlewareWebSite.csproj
index b44c9f43fd..f530d05c7d 100644
--- a/test/WebSites/ErrorPageMiddlewareWebSite/ErrorPageMiddlewareWebSite.csproj
+++ b/test/WebSites/ErrorPageMiddlewareWebSite/ErrorPageMiddlewareWebSite.csproj
@@ -8,7 +8,6 @@
-
diff --git a/test/WebSites/ErrorPageMiddlewareWebSite/Startup.cs b/test/WebSites/ErrorPageMiddlewareWebSite/Startup.cs
index a2e6663235..6da154499f 100644
--- a/test/WebSites/ErrorPageMiddlewareWebSite/Startup.cs
+++ b/test/WebSites/ErrorPageMiddlewareWebSite/Startup.cs
@@ -18,8 +18,6 @@ namespace ErrorPageMiddlewareWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseDeveloperExceptionPage();
app.UseMvc();
}
diff --git a/test/WebSites/FilesWebSite/FilesWebSite.csproj b/test/WebSites/FilesWebSite/FilesWebSite.csproj
index c06de41ab0..1b7e679313 100644
--- a/test/WebSites/FilesWebSite/FilesWebSite.csproj
+++ b/test/WebSites/FilesWebSite/FilesWebSite.csproj
@@ -13,7 +13,6 @@
-
diff --git a/test/WebSites/FilesWebSite/Startup.cs b/test/WebSites/FilesWebSite/Startup.cs
index 5fbb3a7ff9..c75c9720f8 100644
--- a/test/WebSites/FilesWebSite/Startup.cs
+++ b/test/WebSites/FilesWebSite/Startup.cs
@@ -18,8 +18,6 @@ namespace FilesWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvc(routes =>
{
routes.MapRoute(name: null, template: "{controller}/{action}", defaults: null);
diff --git a/test/WebSites/FiltersWebSite/FiltersWebSite.csproj b/test/WebSites/FiltersWebSite/FiltersWebSite.csproj
index 27414d1e83..a99a2f5a43 100644
--- a/test/WebSites/FiltersWebSite/FiltersWebSite.csproj
+++ b/test/WebSites/FiltersWebSite/FiltersWebSite.csproj
@@ -9,7 +9,6 @@
-
diff --git a/test/WebSites/FiltersWebSite/Startup.cs b/test/WebSites/FiltersWebSite/Startup.cs
index cbe6e77996..eec802ba7d 100644
--- a/test/WebSites/FiltersWebSite/Startup.cs
+++ b/test/WebSites/FiltersWebSite/Startup.cs
@@ -60,8 +60,6 @@ namespace FiltersWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMiddleware();
app.UseMvcWithDefaultRoute();
diff --git a/test/WebSites/FormatterWebSite/FormatterWebSite.csproj b/test/WebSites/FormatterWebSite/FormatterWebSite.csproj
index 347d0f902c..c317e7be10 100644
--- a/test/WebSites/FormatterWebSite/FormatterWebSite.csproj
+++ b/test/WebSites/FormatterWebSite/FormatterWebSite.csproj
@@ -9,7 +9,6 @@
-
diff --git a/test/WebSites/FormatterWebSite/Startup.cs b/test/WebSites/FormatterWebSite/Startup.cs
index a2d53bf982..dd3beb9121 100644
--- a/test/WebSites/FormatterWebSite/Startup.cs
+++ b/test/WebSites/FormatterWebSite/Startup.cs
@@ -24,8 +24,6 @@ namespace FormatterWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvc(routes =>
{
routes.MapRoute("ActionAsMethod", "{controller}/{action}",
diff --git a/test/WebSites/FormatterWebSite/StartupWithRespectBrowserAcceptHeader.cs b/test/WebSites/FormatterWebSite/StartupWithRespectBrowserAcceptHeader.cs
index 217bc78573..839e60b1c7 100644
--- a/test/WebSites/FormatterWebSite/StartupWithRespectBrowserAcceptHeader.cs
+++ b/test/WebSites/FormatterWebSite/StartupWithRespectBrowserAcceptHeader.cs
@@ -18,8 +18,6 @@ namespace FormatterWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvc(routes =>
{
routes.MapRoute("ActionAsMethod", "{controller}/{action}",
diff --git a/test/WebSites/HtmlGenerationWebSite/HtmlGenerationWebSite.csproj b/test/WebSites/HtmlGenerationWebSite/HtmlGenerationWebSite.csproj
index 888f6267fc..c46bbf9fe7 100644
--- a/test/WebSites/HtmlGenerationWebSite/HtmlGenerationWebSite.csproj
+++ b/test/WebSites/HtmlGenerationWebSite/HtmlGenerationWebSite.csproj
@@ -8,7 +8,6 @@
-
diff --git a/test/WebSites/HtmlGenerationWebSite/Startup.cs b/test/WebSites/HtmlGenerationWebSite/Startup.cs
index 8d5f6b2c5e..d2ecbea617 100644
--- a/test/WebSites/HtmlGenerationWebSite/Startup.cs
+++ b/test/WebSites/HtmlGenerationWebSite/Startup.cs
@@ -24,7 +24,6 @@ namespace HtmlGenerationWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
app.UseStaticFiles();
app.UseMvc(routes =>
{
diff --git a/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/BuilderExtensions.cs b/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/BuilderExtensions.cs
deleted file mode 100644
index ac6727a6ff..0000000000
--- a/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/BuilderExtensions.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using Microsoft.AspNetCore.Mvc.TestConfiguration;
-
-namespace Microsoft.AspNetCore.Builder
-{
- public static class BuilderExtensions
- {
- // Should be added to the pipeline as early as possible.
- public static IApplicationBuilder UseCultureReplacer(this IApplicationBuilder app)
- {
- return app.UseMiddleware();
- }
- }
-}
\ No newline at end of file
diff --git a/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/Microsoft.AspNetCore.Mvc.TestConfiguration.csproj b/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/Microsoft.AspNetCore.Mvc.TestConfiguration.csproj
deleted file mode 100644
index 3e0c336018..0000000000
--- a/test/WebSites/Microsoft.AspNetCore.Mvc.TestConfiguration/Microsoft.AspNetCore.Mvc.TestConfiguration.csproj
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
- netcoreapp2.0;net461
- netcoreapp2.0
-
-
-
-
-
-
-
-
-
-
diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj b/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj
index d7d54054f6..b0efeb2e41 100644
--- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj
+++ b/test/WebSites/RazorPageExecutionInstrumentationWebSite/RazorPageExecutionInstrumentationWebSite.csproj
@@ -8,7 +8,6 @@
-
diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs
index 79f3568ab7..454aedb8e5 100644
--- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs
+++ b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs
@@ -28,8 +28,6 @@ namespace RazorPageExecutionInstrumentationWebSite
var diagnosticSource = app.ApplicationServices.GetRequiredService();
diagnosticSource.SubscribeWithAdapter(listener);
- app.UseCultureReplacer();
-
app.Use(async (context, next) =>
{
using (var writer = new StreamWriter(context.Response.Body))
diff --git a/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj b/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj
index d81a38d3ca..046fb22547 100644
--- a/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj
+++ b/test/WebSites/RazorPagesWebSite/RazorPagesWebSite.csproj
@@ -8,7 +8,6 @@
-
diff --git a/test/WebSites/RazorPagesWebSite/Startup.cs b/test/WebSites/RazorPagesWebSite/Startup.cs
index 76a0bf7dec..8c3445f82b 100644
--- a/test/WebSites/RazorPagesWebSite/Startup.cs
+++ b/test/WebSites/RazorPagesWebSite/Startup.cs
@@ -27,8 +27,6 @@ namespace RazorPagesWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseAuthentication();
app.UseStaticFiles();
diff --git a/test/WebSites/RazorPagesWebSite/StartupWithBasePath.cs b/test/WebSites/RazorPagesWebSite/StartupWithBasePath.cs
index 040e41597a..cafae0f4fd 100644
--- a/test/WebSites/RazorPagesWebSite/StartupWithBasePath.cs
+++ b/test/WebSites/RazorPagesWebSite/StartupWithBasePath.cs
@@ -23,8 +23,6 @@ namespace RazorPagesWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseAuthentication();
app.UseStaticFiles();
diff --git a/test/WebSites/RazorWebSite/RazorWebSite.csproj b/test/WebSites/RazorWebSite/RazorWebSite.csproj
index d087f196fd..4f67aa13d2 100644
--- a/test/WebSites/RazorWebSite/RazorWebSite.csproj
+++ b/test/WebSites/RazorWebSite/RazorWebSite.csproj
@@ -13,7 +13,6 @@
-
diff --git a/test/WebSites/RoutingWebSite/RoutingWebSite.csproj b/test/WebSites/RoutingWebSite/RoutingWebSite.csproj
index 888f6267fc..c46bbf9fe7 100644
--- a/test/WebSites/RoutingWebSite/RoutingWebSite.csproj
+++ b/test/WebSites/RoutingWebSite/RoutingWebSite.csproj
@@ -8,7 +8,6 @@
-
diff --git a/test/WebSites/RoutingWebSite/Startup.cs b/test/WebSites/RoutingWebSite/Startup.cs
index 969a7c3ea1..2fed21a9b8 100644
--- a/test/WebSites/RoutingWebSite/Startup.cs
+++ b/test/WebSites/RoutingWebSite/Startup.cs
@@ -22,8 +22,6 @@ namespace RoutingWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvc(routes =>
{
routes.MapAreaRoute(
diff --git a/test/WebSites/TagHelpersWebSite/Startup.cs b/test/WebSites/TagHelpersWebSite/Startup.cs
index 696c61dde0..f9200d9ea0 100644
--- a/test/WebSites/TagHelpersWebSite/Startup.cs
+++ b/test/WebSites/TagHelpersWebSite/Startup.cs
@@ -18,8 +18,6 @@ namespace TagHelpersWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvcWithDefaultRoute();
}
diff --git a/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj b/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj
index 8af65cd909..c0972fba15 100644
--- a/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj
+++ b/test/WebSites/TagHelpersWebSite/TagHelpersWebSite.csproj
@@ -9,7 +9,6 @@
-
diff --git a/test/WebSites/VersioningWebSite/Startup.cs b/test/WebSites/VersioningWebSite/Startup.cs
index 8995fe8d1e..72cfc00409 100644
--- a/test/WebSites/VersioningWebSite/Startup.cs
+++ b/test/WebSites/VersioningWebSite/Startup.cs
@@ -22,8 +22,6 @@ namespace VersioningWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvcWithDefaultRoute();
}
diff --git a/test/WebSites/VersioningWebSite/VersioningWebSite.csproj b/test/WebSites/VersioningWebSite/VersioningWebSite.csproj
index 888f6267fc..c46bbf9fe7 100644
--- a/test/WebSites/VersioningWebSite/VersioningWebSite.csproj
+++ b/test/WebSites/VersioningWebSite/VersioningWebSite.csproj
@@ -8,7 +8,6 @@
-
diff --git a/test/WebSites/WebApiCompatShimWebSite/Startup.cs b/test/WebSites/WebApiCompatShimWebSite/Startup.cs
index 7813b1e7ce..a02a76c3b0 100644
--- a/test/WebSites/WebApiCompatShimWebSite/Startup.cs
+++ b/test/WebSites/WebApiCompatShimWebSite/Startup.cs
@@ -18,8 +18,6 @@ namespace WebApiCompatShimWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
app.UseMvc(routes =>
{
// Tests include different styles of WebAPI conventional routing and action selection - the prefix keeps
diff --git a/test/WebSites/WebApiCompatShimWebSite/WebApiCompatShimWebSite.csproj b/test/WebSites/WebApiCompatShimWebSite/WebApiCompatShimWebSite.csproj
index ea542c51f0..74dcef1ea8 100644
--- a/test/WebSites/WebApiCompatShimWebSite/WebApiCompatShimWebSite.csproj
+++ b/test/WebSites/WebApiCompatShimWebSite/WebApiCompatShimWebSite.csproj
@@ -10,7 +10,6 @@
-
diff --git a/test/WebSites/XmlFormattersWebSite/Startup.cs b/test/WebSites/XmlFormattersWebSite/Startup.cs
index 48e97ed802..7bdfc7871d 100644
--- a/test/WebSites/XmlFormattersWebSite/Startup.cs
+++ b/test/WebSites/XmlFormattersWebSite/Startup.cs
@@ -68,9 +68,6 @@ namespace XmlFormattersWebSite
public void Configure(IApplicationBuilder app)
{
- app.UseCultureReplacer();
-
- // Add MVC to the request pipeline
app.UseMvc(routes =>
{
routes.MapRoute("ActionAsMethod", "{controller}/{action}",
diff --git a/test/WebSites/XmlFormattersWebSite/XmlFormattersWebSite.csproj b/test/WebSites/XmlFormattersWebSite/XmlFormattersWebSite.csproj
index 347d0f902c..c317e7be10 100644
--- a/test/WebSites/XmlFormattersWebSite/XmlFormattersWebSite.csproj
+++ b/test/WebSites/XmlFormattersWebSite/XmlFormattersWebSite.csproj
@@ -9,7 +9,6 @@
-