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
path: root/src
diff options
context:
space:
mode:
authorViktor Hofer <viktor.hofer@outlook.com>2017-08-05 01:42:53 +0300
committerViktor Hofer <viktor.hofer@outlook.com>2017-08-05 01:42:53 +0300
commiteb583039b1ffd3dee3b3d6fbc4c5b6b6a5f3f621 (patch)
treee6d248ddd5ae54543c3f80b431f8b36dfd06810e /src
parent31ff04994e41cd999cbbd3191b054f6e6713c6f8 (diff)
Set CurrentUICulture before retrieving DisplayName in RegionInfo and isolate static thread changes
Diffstat (limited to 'src')
-rw-r--r--src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs b/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs
index bba87ca74b..ac47834aa8 100644
--- a/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs
+++ b/src/System.Globalization/tests/RegionInfo/RegionInfoTests.Properties.cs
@@ -3,37 +3,40 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
+using System.Diagnostics;
using System.Linq;
using Xunit;
namespace System.Globalization.Tests
{
- public class RegionInfoPropertyTests
+ public class RegionInfoPropertyTests : RemoteExecutorTestBase
{
[Fact]
public void CurrentRegion()
{
- CultureInfo oldThreadCulture = CultureInfo.CurrentCulture;
-
- try
+ RemoteInvoke(() =>
{
CultureInfo.CurrentCulture = new CultureInfo("en-US");
RegionInfo ri = new RegionInfo(new RegionInfo(CultureInfo.CurrentCulture.Name).TwoLetterISORegionName);
Assert.True(RegionInfo.CurrentRegion.Equals(ri) || RegionInfo.CurrentRegion.Equals(new RegionInfo(CultureInfo.CurrentCulture.Name)));
Assert.Same(RegionInfo.CurrentRegion, RegionInfo.CurrentRegion);
- }
- finally
- {
- CultureInfo.CurrentCulture = oldThreadCulture;
- }
+
+ return SuccessExitCode;
+ }).Dispose();
}
[Theory]
[InlineData("en-US", "United States")]
public void DisplayName(string name, string expected)
{
- Assert.Equal(expected, new RegionInfo(name).DisplayName);
+ RemoteInvoke((string _name, string _expected) =>
+ {
+ CultureInfo.CurrentUICulture = new CultureInfo(_name);
+ Assert.Equal(_expected, new RegionInfo(_name).DisplayName);
+
+ return SuccessExitCode;
+ }, name, expected).Dispose();
}
[Theory]