Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 18ab7fb

Browse files
committed
Fix CultureInfo tests on .NET Core
1 parent 98fa268 commit 18ab7fb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/ServiceStack.Text.Tests/CultureInfoTests.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if !NETCORE
21
using System;
32
using System.Globalization;
43
using System.Threading;
@@ -17,16 +16,25 @@ public class CultureInfoTests
1716
[TestFixtureSetUp]
1817
public void TestFixtureSetUp()
1918
{
19+
#if NETCORE
20+
previousCulture = CultureInfo.CurrentCulture;
21+
CultureInfo.CurrentCulture = new CultureInfo("fr-FR");
22+
#else
2023
previousCulture = Thread.CurrentThread.CurrentCulture;
2124
//Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-BR");
2225
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
2326
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");
27+
#endif
2428
}
2529

2630
[TestFixtureTearDown]
2731
public void TestFixtureTearDown()
2832
{
33+
#if NETCORE
34+
CultureInfo.CurrentCulture = previousCulture;
35+
#else
2936
Thread.CurrentThread.CurrentCulture = previousCulture;
37+
#endif
3038
}
3139

3240
[Test]
@@ -103,4 +111,3 @@ public void Does_use_invariant_culture_for_numbers()
103111

104112
}
105113
}
106-
#endif

0 commit comments

Comments
 (0)