Skip to content

Commit

Permalink
Fixed netfx System.Text.Encoding.Tests fails on non-English Windows (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRadch authored and stephentoub committed Mar 23, 2018
1 parent 42af176 commit 07c8f9a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Diagnostics;
using System.Globalization;
using Xunit;

namespace System.Text.Tests
{
public class EncodingGetEncodingTest
public class EncodingGetEncodingTest : RemoteExecutorTestBase
{
[Fact]
public void GetEncoding_String_Invalid()
Expand Down Expand Up @@ -99,10 +100,10 @@ public void TestEncodingNameAndCopdepageNumber()
[Fact]
public void GetEncoding_EncodingName()
{
CultureInfo originalUICulture = CultureInfo.CurrentUICulture;
try
// Workaround issue: UWP culture is process wide
RemoteInvoke(() =>
{
CultureInfo.CurrentCulture = new CultureInfo("en-US");
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;

foreach (var map in s_mapping)
{
Expand All @@ -115,11 +116,7 @@ public void GetEncoding_EncodingName()

Assert.All(name, ch => Assert.InRange(ch, 0, 127));
}
}
finally
{
CultureInfo.CurrentUICulture = originalUICulture;
}
}).Dispose();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,11 @@
<Compile Include="Decoder\Decoder.cs" />
<Compile Include="Encoder\Encoder.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>

0 comments on commit 07c8f9a

Please sign in to comment.