Skip to content

Commit 511c158

Browse files
committed
Merge branch 'just-another-working-test' of github.com:StefanBertels/CsvHelper into StefanBertels-just-another-working-test
2 parents aa8adec + 4623ef4 commit 511c158

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Globalization;
2+
using System.IO;
3+
using System.Linq;
4+
using CsvHelper.Configuration;
5+
using Xunit;
6+
7+
namespace CsvHelper.Tests.Reading
8+
{
9+
public class NumberReadingTests
10+
{
11+
[Fact]
12+
public void ReadDecimalDoubleCultureDeInvariantMix()
13+
{
14+
var input = new StringReader("""
15+
MyMoney;YourMoney;MoreMoney;BigMoney
16+
1.2;3.4;5.6;7.8
17+
""");
18+
19+
using var cr = new CsvReader(input, new CsvConfiguration(CultureInfo.InvariantCulture) { Delimiter = ";" });
20+
var records = cr.GetRecords(new
21+
{
22+
MyMoney = default(decimal),
23+
YourMoney = default(double),
24+
MoreMoney = default(decimal?),
25+
BigMoney = default(double?),
26+
}).ToArray();
27+
28+
Assert.Equal(1.2m, records.Single().MyMoney);
29+
Assert.Equal(3.4, records.Single().YourMoney);
30+
Assert.Equal(5.6m, records.Single().MoreMoney);
31+
Assert.Equal(7.8, records.Single().BigMoney);
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)