Skip to content

Commit 31345e7

Browse files
author
Sébastien Geiser
committed
Numbers InProgress
1 parent 9aa43c9 commit 31345e7

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorTests.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using System.Text.RegularExpressions;
55
using Shouldly;
66
using Newtonsoft.Json;
7+
using System.Globalization;
8+
using System.Threading;
79

810
namespace CodingSeb.ExpressionEvaluator.Tests
911
{
@@ -1402,5 +1404,40 @@ public void ExceptionThrowingEvaluation(ExpressionEvaluator evaluator, string ex
14021404
}
14031405

14041406
#endregion
1407+
1408+
#region NumbersWithCommaDecimalSeparatorCulture
1409+
1410+
[TestCase("0,5", ExpectedResult = 0.5, Category = "Numbers")]
1411+
public object NumbersWithCommaDecimalSeparatorCulture(string expression)
1412+
{
1413+
object result = null;
1414+
1415+
CultureInfo oldCultureInfo = Thread.CurrentThread.CurrentCulture;
1416+
CultureInfo oldCultureUIInfo = Thread.CurrentThread.CurrentUICulture;
1417+
1418+
//CultureInfo cultureInfo = new CultureInfo("en");
1419+
1420+
//cultureInfo.NumberFormat.NumberDecimalSeparator = ",";
1421+
1422+
//Thread.CurrentThread.CurrentCulture = cultureInfo;
1423+
//Thread.CurrentThread.CurrentUICulture = cultureInfo;
1424+
1425+
try
1426+
{
1427+
1428+
ExpressionEvaluator evaluator = new ExpressionEvaluator();
1429+
1430+
result = evaluator.Evaluate(expression);
1431+
}
1432+
finally
1433+
{
1434+
Thread.CurrentThread.CurrentCulture = oldCultureInfo;
1435+
Thread.CurrentThread.CurrentUICulture = oldCultureUIInfo;
1436+
}
1437+
1438+
return result;
1439+
}
1440+
1441+
#endregion
14051442
}
14061443
}

0 commit comments

Comments
 (0)