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 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.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.MacOSX)]
[InlineData(RuntimeFlavor.Clr, "http://localhost:5080/", RuntimeArchitecture.x64)] public Task RunSite_WindowsOnly()
[InlineData(RuntimeFlavor.CoreClr, "http://localhost:5081/", RuntimeArchitecture.x64)]
public Task RunSite_WindowsOnly(RuntimeFlavor runtimeFlavor, string applicationBaseUrl, RuntimeArchitecture runtimeArchitecture)
{ {
var testRunner = new TestRunner(_applicationPath); var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponseHeading( return testRunner.RunTestAndVerifyResponseHeading(
runtimeFlavor, RuntimeFlavor.Clr,
runtimeArchitecture, RuntimeArchitecture.x64,
applicationBaseUrl, "http://localhost:5080",
"My/Resources", "My/Resources",
"fr-FR", "fr-FR",
"<h1>Bonjour</h1>"); "<h1>Bonjour</h1>");
} }
[Fact]
[ConditionalTheory] public Task RunSite_AnyOS()
[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)
{ {
var testRunner = new TestRunner(_applicationPath); var testRunner = new TestRunner(_applicationPath);
return testRunner.RunTestAndVerifyResponseHeading( return testRunner.RunTestAndVerifyResponseHeading(
runtimeFlavor, RuntimeFlavor.CoreClr,
runtimeArchitecture, RuntimeArchitecture.x64,
applicationBaseUrl, "http://localhost:5081/",
"My/Resources", "My/Resources",
"fr-FR", "fr-FR",
"<h1>Bonjour</h1>"); "<h1>Bonjour</h1>");

View File

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