Skip to content

Commit

Permalink
Ensure that this new test can't just pass by leaving the object in it…
Browse files Browse the repository at this point in the history
…s default state.
  • Loading branch information
airbreather committed Feb 9, 2024
1 parent 83beaba commit 912e5f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions YamlDotNet.Test/Serialization/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<HasNestedDictionary>(yaml);
Assert.Contains(new KeyValuePair<int, HasNestedDictionary.Payload>(1, new HasNestedDictionary.Payload { I = 1 }), dct.Lookups);
}
Expand Down Expand Up @@ -2559,7 +2559,7 @@ public void WriteYaml(IEmitter emitter, object value, Type type)

public sealed class HasNestedDictionary
{
public Dictionary<int, Payload> Lookups { get; set; } = new Dictionary<int, Payload> { [1] = new Payload { I = 1 } };
public Dictionary<int, Payload> Lookups { get; set; } = new Dictionary<int, Payload>();

public struct Payload
{
Expand Down

0 comments on commit 912e5f9

Please sign in to comment.