From 10a66689ef747c802e642ce98e31419d52d6fd05 Mon Sep 17 00:00:00 2001 From: Javier Ciberman Mora Date: Thu, 30 Mar 2023 00:25:49 -0300 Subject: [PATCH] Fixes test `DeserializeScalarEdgeCases` for non english cultures. The test fails if the machine culture does not use the dot decimal separator. This is caused due to `object.ToString()` being used that is culture sensitive. This commit fixes the test using `string.Format` with `CultureInfo.InvariantCulture` --- YamlDotNet.Test/Serialization/DeserializerTest.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/YamlDotNet.Test/Serialization/DeserializerTest.cs b/YamlDotNet.Test/Serialization/DeserializerTest.cs index 64213648..9b2a4580 100644 --- a/YamlDotNet.Test/Serialization/DeserializerTest.cs +++ b/YamlDotNet.Test/Serialization/DeserializerTest.cs @@ -28,6 +28,7 @@ using YamlDotNet.Core; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; +using System.Globalization; namespace YamlDotNet.Test.Serialization { @@ -279,7 +280,8 @@ public static IEnumerable DeserializeScalarEdgeCases_TestCases public void DeserializeScalarEdgeCases(IConvertible value, Type type) { var deserializer = new DeserializerBuilder().Build(); - var result = deserializer.Deserialize(value.ToString(), type); + var stringValue = string.Format(CultureInfo.InvariantCulture, "{0}", value); + var result = deserializer.Deserialize(stringValue, type); result.Should().Be(value); }