-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BDB-12] Fix double to string culture difference
- Loading branch information
1 parent
05a3d4a
commit b4a1261
Showing
4 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Core/BuildingBlock.Core.Domain/Shared/Utils/DoubleUtility.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Globalization; | ||
|
||
namespace BuildingBlock.Core.Domain.Shared.Utils; | ||
|
||
public static class DoubleUtility | ||
{ | ||
public static string ToString(double value) | ||
{ | ||
var valueString = value.ToString(CultureInfo.InvariantCulture); | ||
|
||
return valueString.Replace('.', ','); | ||
} | ||
} |
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
Tests/BuildingBlock.Test.UnitTest/Core/Domain/Shared/Utils/DoubleUtilityTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using BuildingBlock.Core.Domain.Shared.Utils; | ||
using FluentAssertions; | ||
|
||
namespace Tests.Core.Domain.Shared.Utils; | ||
|
||
public class DoubleUtilityTest | ||
{ | ||
public class ToString | ||
{ | ||
[Fact] | ||
public void ShouldConvertDoubleWithDot() | ||
{ | ||
var actualData = DoubleUtility.ToString(1.1); | ||
|
||
actualData.Should().Be("1,1"); | ||
} | ||
} | ||
} |