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 {