forked from zzzprojects/System.Linq.Dynamic.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumberParserTests.cs
More file actions
42 lines (34 loc) · 1.05 KB
/
NumberParserTests.cs
File metadata and controls
42 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Globalization;
using NFluent;
using System.Linq.Dynamic.Core.Parser;
using Xunit;
namespace System.Linq.Dynamic.Core.Tests.Parser
{
public class NumberParserTests
{
private readonly ParsingConfig _parsingConfig = new ParsingConfig();
private readonly NumberParser _sut;
public NumberParserTests()
{
_sut = new NumberParser(_parsingConfig);
}
[Fact]
public void NumberParser_ParseNumber_Decimal_With_DefaultCulture()
{
// Act
var result = _sut.ParseNumber("3.21", typeof(decimal));
// Assert
Check.That(result).Equals(3.21m);
}
[Fact]
public void NumberParser_ParseNumber_Decimal_With_GermanCulture()
{
// Assign
_parsingConfig.NumberParseCulture = CultureInfo.CreateSpecificCulture("de-DE");
// Act
var result = _sut.ParseNumber("3,21", typeof(decimal));
// Assert
Check.That(result).Equals(3.21m);
}
}
}