Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Radchenko <radchenkosasha@gmail.com>2018-04-07 02:24:26 +0300
committerJeremy Kuhne <jeremy.kuhne@microsoft.com>2018-04-07 02:24:26 +0300
commitda1322d90a1412290a82a5ace157da4cc58dabf4 (patch)
tree856c6a5e82c31bdac01b9b4ee8b42570310abd82
parent11a57828a59479532153b4f8c67aaaeb68eb7d79 (diff)
Fixed netfx System.Configuration.ConfigurationManager.Tests on non English Windows (#28164)
* Fixed netfx System.Configuration.ConfigurationManager.Tests on non English Windows * Added RemoteInvoke
-rw-r--r--src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationErrorsExceptionTest.cs8
-rw-r--r--src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj6
-rw-r--r--src/System.Configuration.ConfigurationManager/tests/System/Configuration/TimeSpanValidatorAttributeTests.cs45
3 files changed, 44 insertions, 15 deletions
diff --git a/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationErrorsExceptionTest.cs b/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationErrorsExceptionTest.cs
index 6d958e74d6..9d8c52170b 100644
--- a/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationErrorsExceptionTest.cs
+++ b/src/System.Configuration.ConfigurationManager/tests/Mono/ConfigurationErrorsExceptionTest.cs
@@ -31,6 +31,7 @@ using System;
using System.Configuration;
using System.Configuration.Internal;
using System.IO;
+using System.Text.RegularExpressions;
using System.Xml;
using Xunit;
@@ -44,7 +45,12 @@ namespace MonoTests.System.Configuration
{
ConfigurationErrorsException cee = new ConfigurationErrorsException();
Assert.NotNull(cee.BareMessage);
- Assert.True(cee.BareMessage.IndexOf("'" + typeof(ConfigurationErrorsException).FullName + "'") != -1, "#2:" + cee.BareMessage);
+
+ // \p{Pi} any kind of opening quote https://www.compart.com/en/unicode/category/Pi
+ // \p{Pf} any kind of closing quote https://www.compart.com/en/unicode/category/Pf
+ // \p{Po} any kind of punctuation character that is not a dash, bracket, quote or connector https://www.compart.com/en/unicode/category/Po
+ Assert.True(Regex.IsMatch(cee.BareMessage, @"[\p{Pi}\p{Po}]" + Regex.Escape(typeof(ConfigurationErrorsException).FullName) + @"[\p{Pf}\p{Po}]"), "#2:" + cee.BareMessage);
+
Assert.NotNull(cee.Data);
Assert.Equal(0, cee.Data.Count);
Assert.Null(cee.Filename);
diff --git a/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj b/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj
index 1ef4b09630..2e8c9f65d4 100644
--- a/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj
+++ b/src/System.Configuration.ConfigurationManager/tests/System.Configuration.ConfigurationManager.Tests.csproj
@@ -105,5 +105,11 @@
<Compile Include="System\Configuration\ValidatiorUtilsTests.cs" />
<Compile Include="System\Drawing\Configuration\SystemDrawingSectionTests.cs" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(CommonTestPath)\System\Diagnostics\RemoteExecutorConsoleApp\RemoteExecutorConsoleApp.csproj">
+ <Project>{69e46a6f-9966-45a5-8945-2559fe337827}</Project>
+ <Name>RemoteExecutorConsoleApp</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project> \ No newline at end of file
diff --git a/src/System.Configuration.ConfigurationManager/tests/System/Configuration/TimeSpanValidatorAttributeTests.cs b/src/System.Configuration.ConfigurationManager/tests/System/Configuration/TimeSpanValidatorAttributeTests.cs
index 4c9ae4abb2..89fe0e07cd 100644
--- a/src/System.Configuration.ConfigurationManager/tests/System/Configuration/TimeSpanValidatorAttributeTests.cs
+++ b/src/System.Configuration.ConfigurationManager/tests/System/Configuration/TimeSpanValidatorAttributeTests.cs
@@ -3,11 +3,14 @@
// See the LICENSE file in the project root for more information.
using System.Configuration;
+using System.Diagnostics;
+using System.Globalization;
+
using Xunit;
namespace System.ConfigurationTests
{
- public class TimeSpanValidatorAttributeTests
+ public class TimeSpanValidatorAttributeTests : RemoteExecutorTestBase
{
[Fact]
public void MinValueString_GetString()
@@ -111,27 +114,41 @@ namespace System.ConfigurationTests
}
[Fact]
- [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot,"Exception messages are different")]
+ [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Exception messages are different")]
public void MinValueString_TooSmall()
{
- TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();
-
- attribute.MaxValueString = new TimeSpan(2, 2, 2, 2).ToString();
- ArgumentOutOfRangeException result = Assert.Throws<ArgumentOutOfRangeException>(() => attribute.MinValueString = new TimeSpan(3, 3, 3, 3).ToString());
- ArgumentOutOfRangeException expectedException = new ArgumentOutOfRangeException("value", SR.Validator_min_greater_than_max);
- Assert.Equal(expectedException.Message, result.Message);
+ RemoteInvoke(() =>
+ {
+ CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
+
+ TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();
+
+ attribute.MaxValueString = new TimeSpan(2, 2, 2, 2).ToString();
+ ArgumentOutOfRangeException result = Assert.Throws<ArgumentOutOfRangeException>(() =>
+ attribute.MinValueString = new TimeSpan(3, 3, 3, 3).ToString());
+ ArgumentOutOfRangeException expectedException =
+ new ArgumentOutOfRangeException("value", SR.Validator_min_greater_than_max);
+ Assert.Equal(expectedException.Message, result.Message);
+ }).Dispose();
}
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Exception messages are different")]
public void MaxValueString_TooBig()
{
- TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();
-
- attribute.MinValueString = new TimeSpan(2, 2, 2, 2).ToString();
- ArgumentOutOfRangeException result = Assert.Throws<ArgumentOutOfRangeException>(() => attribute.MaxValueString = new TimeSpan(1, 1, 1, 1).ToString());
- ArgumentOutOfRangeException expectedException = new ArgumentOutOfRangeException("value", SR.Validator_min_greater_than_max);
- Assert.Equal(expectedException.Message, result.Message);
+ RemoteInvoke(() =>
+ {
+ CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
+
+ TimeSpanValidatorAttribute attribute = new TimeSpanValidatorAttribute();
+
+ attribute.MinValueString = new TimeSpan(2, 2, 2, 2).ToString();
+ ArgumentOutOfRangeException result = Assert.Throws<ArgumentOutOfRangeException>(() =>
+ attribute.MaxValueString = new TimeSpan(1, 1, 1, 1).ToString());
+ ArgumentOutOfRangeException expectedException =
+ new ArgumentOutOfRangeException("value", SR.Validator_min_greater_than_max);
+ Assert.Equal(expectedException.Message, result.Message);
+ }).Dispose();
}
}
}