From 963ff8807754ad38923478ff33113c4909e9ede2 Mon Sep 17 00:00:00 2001 From: SergeyFM Date: Fri, 10 May 2024 11:05:15 +0300 Subject: [PATCH] Set the current culture to invariant culture for consistent numeric formatting across different environments. This is crucial because the output of string formatting for numbers can vary based on the machine's locale settings. Using the invariant culture ensures that the format "12,345.00" will be consistent regardless of the regional settings of the system on which this test runs. --- OpenXMLTemplatesTest/Variables/VariableSourceTests.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenXMLTemplatesTest/Variables/VariableSourceTests.cs b/OpenXMLTemplatesTest/Variables/VariableSourceTests.cs index 0599c09..f8150ef 100644 --- a/OpenXMLTemplatesTest/Variables/VariableSourceTests.cs +++ b/OpenXMLTemplatesTest/Variables/VariableSourceTests.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Globalization; using NUnit.Framework; using OpenXMLTemplates.Variables; using OpenXMLTemplates.Variables.Exceptions; @@ -47,6 +48,9 @@ public void Format_Numeric_Fields_Value_Null() [Test] public void Format_Numeric_Fields() { + // Set the current culture to invariant culture for consistent numeric formatting across different environments. + CultureInfo.CurrentCulture = CultureInfo.InvariantCulture; + var data = new Dictionary { { "prices", new List { "123", "12345.0001" } }