Skip to content

Commit

Permalink
Use AmbientCulture
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Mar 27, 2014
1 parent 369e0a4 commit c709c91
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/Humanizer.Tests/AmbientCulture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class AmbientCulture : IDisposable
public AmbientCulture(CultureInfo culture)
{
_culture = Thread.CurrentThread.CurrentUICulture;
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}

Expand Down
11 changes: 3 additions & 8 deletions src/Humanizer.Tests/Bytes/ByteSizeExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using System.Globalization;
using System.Threading;
using Humanizer.Bytes;
using Humanizer.Bytes;
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Bytes
{
public class ByteSizeExtensionsTests
public class ByteSizeExtensionsTests : AmbientCulture
{
public ByteSizeExtensionsTests()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
}
public ByteSizeExtensionsTests() : base("en") { }

[Fact]
public void Terabytes()
Expand Down
10 changes: 3 additions & 7 deletions src/Humanizer.Tests/Bytes/ParsingTests.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
using System;
using System.Globalization;
using System.Threading;

using Humanizer.Bytes;
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Bytes
{
public class ParsingTests
public class ParsingTests : AmbientCulture
{
public ParsingTests()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
}
public ParsingTests() : base("en") { }

[Fact]
public void Parse()
Expand Down
11 changes: 3 additions & 8 deletions src/Humanizer.Tests/Bytes/ToStringTests.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
using System.Globalization;
using System.Threading;
using Humanizer.Bytes;
using Humanizer.Bytes;
using Xunit;

namespace Humanizer.Tests.Bytes
{
public class ToStringTests
public class ToStringTests : AmbientCulture
{
public ToStringTests()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
}
public ToStringTests() : base("en") { }

[Fact]
public void ReturnsLargestMetricSuffix()
Expand Down

0 comments on commit c709c91

Please sign in to comment.