From 912e5f9ca0f6cda263d191a33db78df7e4fd68ec Mon Sep 17 00:00:00 2001 From: Joe Amenta Date: Fri, 9 Feb 2024 09:11:49 -0500 Subject: [PATCH] Ensure that this new test can't just pass by leaving the object in its default state. --- YamlDotNet.Test/Serialization/SerializationTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/YamlDotNet.Test/Serialization/SerializationTests.cs b/YamlDotNet.Test/Serialization/SerializationTests.cs index bf37668e..5345dc9c 100644 --- a/YamlDotNet.Test/Serialization/SerializationTests.cs +++ b/YamlDotNet.Test/Serialization/SerializationTests.cs @@ -2460,7 +2460,7 @@ public void NamingConventionAppliedToEnumWhenDeserializing() public void NestedDictionaryTypes_ShouldRoundtrip() { var serializer = new SerializerBuilder().EnsureRoundtrip().Build(); - var yaml = serializer.Serialize(new HasNestedDictionary(), typeof(HasNestedDictionary)); + var yaml = serializer.Serialize(new HasNestedDictionary { Lookups = { [1] = new HasNestedDictionary.Payload { I = 1 } } }, typeof(HasNestedDictionary)); var dct = new DeserializerBuilder().Build().Deserialize(yaml); Assert.Contains(new KeyValuePair(1, new HasNestedDictionary.Payload { I = 1 }), dct.Lookups); } @@ -2559,7 +2559,7 @@ public void WriteYaml(IEmitter emitter, object value, Type type) public sealed class HasNestedDictionary { - public Dictionary Lookups { get; set; } = new Dictionary { [1] = new Payload { I = 1 } }; + public Dictionary Lookups { get; set; } = new Dictionary(); public struct Payload {