Organize Functional tests

This commit is contained in:
Ryan Brandenburg 2016-09-30 10:27:31 -07:00
parent e52cab580e
commit cbba45b44e
2 changed files with 98 additions and 155 deletions

View File

@ -11,36 +11,30 @@ namespace Microsoft.AspNetCore.Localization.FunctionalTests
{
public class LocalizationSampleTest
{
private static readonly string _applicationPath = Path.Combine("samples", "LocalizationSample");
private static readonly string _applicationPath = Path.Combine("samples", "LocalizationSample");
[ConditionalTheory]
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
[InlineData(RuntimeFlavor.Clr, "http://localhost:5080/", RuntimeArchitecture.x64)]
[InlineData(RuntimeFlavor.CoreClr, "http://localhost:5081/", RuntimeArchitecture.x64)]
public Task RunSite_WindowsOnly(RuntimeFlavor runtimeFlavor, string applicationBaseUrl, RuntimeArchitecture runtimeArchitecture)
public Task RunSite_WindowsOnly()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponseHeading(
runtimeFlavor,
runtimeArchitecture,
applicationBaseUrl,
RuntimeFlavor.Clr,
RuntimeArchitecture.x64,
"http://localhost:5080",
"My/Resources",
"fr-FR",
"<h1>Bonjour</h1>");
}
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(RuntimeFlavor.Clr, "http://localhost:5080/", RuntimeArchitecture.x64)] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(RuntimeFlavor.CoreClr, "http://localhost:5081/", RuntimeArchitecture.x64)]
public Task RunSite_NonWindowsOnly(RuntimeFlavor runtimeFlavor, string applicationBaseUrl, RuntimeArchitecture runtimeArchitecture)
[Fact]
public Task RunSite_AnyOS()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponseHeading(
runtimeFlavor,
runtimeArchitecture,
applicationBaseUrl,
RuntimeFlavor.CoreClr,
RuntimeArchitecture.x64,
"http://localhost:5081/",
"My/Resources",
"fr-FR",
"<h1>Bonjour</h1>");

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Localization.FunctionalTests
private static readonly string _applicationPath = Path.Combine("test", "LocalizationWebsite");
[Fact]
public Task Localization_CustomCulture()
public Task Localization_CustomCulture_AllOS()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
@ -26,207 +26,156 @@ namespace Microsoft.AspNetCore.Localization.FunctionalTests
"kr10.00");
}
[ConditionalTheory]
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
[InlineData(RuntimeFlavor.Clr, "http://localhost:5070/", RuntimeArchitecture.x64)]
public Task Localization_ResourcesInClassLibrary_ReturnLocalizedValue_Windows(
RuntimeFlavor runtimeFlavor,
string applicationBaseUrl,
RuntimeArchitecture runtimeArchitecture)
public Task Localization_CustomCulture_Windows()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
runtimeFlavor,
runtimeArchitecture,
applicationBaseUrl,
RuntimeFlavor.Clr,
RuntimeArchitecture.x64,
"http://localhost:5071",
"CustomCulturePreserved",
"en-US",
"kr10.00");
}
[Fact]
public Task Localization_ResourcesInClassLibrary_ReturnLocalizedValue_AllOS()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
RuntimeFlavor.CoreClr,
RuntimeArchitecture.x64,
"http://localhost:5072",
"ResourcesInClassLibrary",
"fr-FR",
"Bonjour from ResourcesClassLibraryNoAttribute Bonjour from ResourcesClassLibraryNoAttribute Bonjour from ResourcesClassLibraryWithAttribute Bonjour from ResourcesClassLibraryWithAttribute");
}
[Theory]
[InlineData(RuntimeFlavor.CoreClr, "http://localhost:5071/", RuntimeArchitecture.x64)]
public Task Localization_ResourcesInClassLibrary_ReturnLocalizedValue_AllOS(
RuntimeFlavor runtimeFlavor,
string applicationBaseUrl,
RuntimeArchitecture runtimeArchitecture)
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public Task Localization_ResourcesInClassLibrary_ReturnLocalizedValue_Windows()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
runtimeFlavor,
runtimeArchitecture,
applicationBaseUrl,
RuntimeFlavor.Clr,
RuntimeArchitecture.x64,
"http://localhost:5073",
"ResourcesInClassLibrary",
"fr-FR",
"Bonjour from ResourcesClassLibraryNoAttribute Bonjour from ResourcesClassLibraryNoAttribute Bonjour from ResourcesClassLibraryWithAttribute Bonjour from ResourcesClassLibraryWithAttribute");
}
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
[InlineData(RuntimeFlavor.Clr, "http://localhost:5070/", RuntimeArchitecture.x64)]
[InlineData(RuntimeFlavor.CoreClr, "http://localhost:5071/", RuntimeArchitecture.x64)]
public Task Localization_ResourcesInFolder_ReturnLocalizedValue_Windows(
RuntimeFlavor runtimeFlavor,
string applicationBaseUrl,
RuntimeArchitecture runtimeArchitecture)
[Fact]
public Task Localization_ResourcesInFolder_ReturnLocalizedValue_AllOS()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
runtimeFlavor,
runtimeArchitecture,
applicationBaseUrl,
RuntimeFlavor.CoreClr,
RuntimeArchitecture.x64,
"http://localhost:5074",
"ResourcesInFolder",
"fr-FR",
"Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder Bonjour from Test in resources folder");
}
[ConditionalTheory]
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
[InlineData(RuntimeFlavor.Clr, "http://localhost:5070/", RuntimeArchitecture.x64)]
[InlineData(RuntimeFlavor.CoreClr, "http://localhost:5071/", RuntimeArchitecture.x64)]
public Task Localization_ResourcesInFolder_ReturnLocalizedValue_WithCultureFallback_Windows(
RuntimeFlavor runtimeFlavor,
string applicationBaseUrl,
RuntimeArchitecture runtimeArchitecture)
public Task Localization_ResourcesInFolder_ReturnLocalizedValue_Windows()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
runtimeFlavor,
runtimeArchitecture,
applicationBaseUrl,
RuntimeFlavor.Clr,
RuntimeArchitecture.x64,
"http://localhost:5075/",
"ResourcesInFolder",
"fr-FR",
"Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder Bonjour from Test in resources folder");
}
[Fact]
public Task Localization_ResourcesInFolder_ReturnLocalizedValue_WithCultureFallback_AllOS()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
RuntimeFlavor.CoreClr,
RuntimeArchitecture.x64,
"http://localhost:5076",
"ResourcesInFolder",
"fr-FR-test",
"Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder Bonjour from Test in resources folder");
}
[ConditionalTheory]
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
[InlineData(RuntimeFlavor.Clr, "http://localhost:5070/", RuntimeArchitecture.x64)]
[InlineData(RuntimeFlavor.CoreClr, "http://localhost:5071/", RuntimeArchitecture.x64)]
public Task Localization_ResourcesInFolder_ReturnNonLocalizedValue_CultureHierarchyTooDeep_Windows(
RuntimeFlavor runtimeFlavor,
string applicationBaseUrl,
RuntimeArchitecture runtimeArchitecture)
public Task Localization_ResourcesInFolder_ReturnLocalizedValue_WithCultureFallback_Windows()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
runtimeFlavor,
runtimeArchitecture,
applicationBaseUrl,
RuntimeFlavor.Clr,
RuntimeArchitecture.x64,
"http://localhost:5077",
"ResourcesInFolder",
"fr-FR-test",
"Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder Bonjour from Test in resources folder");
}
[Fact]
public Task Localization_ResourcesInFolder_ReturnNonLocalizedValue_CultureHierarchyTooDeep_AllOS()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
RuntimeFlavor.CoreClr,
RuntimeArchitecture.x64,
"http://localhost:5078/",
"ResourcesInFolder",
"fr-FR-test-again-too-deep-to-work",
"Hello Hello Hello Hello");
}
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Windows)]
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
public Task Localization_ResourcesInFolder_ReturnLocalizedValue_Clr()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
RuntimeFlavor.Clr,
RuntimeArchitecture.x64,
"http://localhost:5072",
"ResourcesInFolder",
"fr-FR",
"Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder Bonjour from Test in resources folder");
}
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Windows)]
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
public Task Localization_ResourcesInFolder_ReturnLocalizedValue_WithCultureFallback_Clr()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
RuntimeFlavor.Clr,
RuntimeArchitecture.x64,
"http://localhost:5072",
"ResourcesInFolder",
"fr-FR-test",
"Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder Bonjour from Test in resources folder");
}
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Windows)]
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
public Task Localization_ResourcesInFolder_ReturnLocalizedValue_CoreCLR_NonWindows()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
RuntimeFlavor.CoreClr,
RuntimeArchitecture.x64,
"http://localhost:5073/",
"ResourcesInFolder",
"fr-FR",
"Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder Bonjour from Test in resources folder");
}
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Windows)]
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
public Task Localization_ResourcesInFolder_ReturnLocalizedValue_WithCultureFallback_CoreCLR_NonWindows()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
RuntimeFlavor.CoreClr,
RuntimeArchitecture.x64,
"http://localhost:5073/",
"ResourcesInFolder",
"fr-FR-test",
"Bonjour from StartupResourcesInFolder Bonjour from Test in resources folder Bonjour from Customer in resources folder Bonjour from Test in resources folder");
}
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
[InlineData(RuntimeFlavor.Clr, "http://localhost:5074/", RuntimeArchitecture.x64)]
[InlineData(RuntimeFlavor.CoreClr, "http://localhost:5075/", RuntimeArchitecture.x64)]
public Task Localization_ResourcesAtRootFolder_ReturnLocalizedValue_Windows(
RuntimeFlavor runtimeFlavor,
string applicationBaseUrl,
RuntimeArchitecture runtimeArchitecture)
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
runtimeFlavor,
runtimeArchitecture,
applicationBaseUrl,
"ResourcesAtRootFolder",
"fr-FR",
"Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in Models folder");
}
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Windows)]
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
public Task Localization_ResourcesAtRootFolder_ReturnLocalizedValue_Clr()
public Task Localization_ResourcesInFolder_ReturnNonLocalizedValue_CultureHierarchyTooDeep_Windows()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
RuntimeFlavor.Clr,
RuntimeArchitecture.x64,
"http://localhost:5076",
"http://localhost:5079/",
"ResourcesInFolder",
"fr-FR-test-again-too-deep-to-work",
"Hello Hello Hello Hello");
}
[Fact]
public Task Localization_ResourcesAtRootFolder_ReturnLocalizedValue_AllOS()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
RuntimeFlavor.CoreClr,
RuntimeArchitecture.x64,
"http://localhost:5070",
"ResourcesAtRootFolder",
"fr-FR",
"Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in Models folder");
}
[ConditionalFact]
[OSSkipCondition(OperatingSystems.Windows)]
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
public Task Localization_ResourcesAtRootFolder_ReturnLocalizedValue_CoreCLR_NonWindows()
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public Task Localization_ResourcesAtRootFolder_ReturnLocalizedValue_Windows()
{
var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponse(
RuntimeFlavor.CoreClr,
RuntimeFlavor.Clr,
RuntimeArchitecture.x64,
"http://localhost:5077/",
"http://localhost:5071",
"ResourcesAtRootFolder",
"fr-FR",
"Bonjour from StartupResourcesAtRootFolder Bonjour from Test in root folder Bonjour from Customer in Models folder");