Skip to content

Commit

Permalink
Added test for nested untyped deserialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
prochnowc committed Oct 6, 2023
1 parent 63f71e2 commit 8255d17
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions YamlDotNet.Test/Analyzers/StaticGenerator/RootCollectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ public void RootObjectWorks()
Assert.Equal("hello", actual["a"]);
Assert.Equal("world", actual["b"]);
}

[Fact]
public void RootNestedObjectWorks()
{
var deserializer = new StaticDeserializerBuilder(new StaticContext()).Build();
var yaml = @"
a:
Test: hello
b:
Test: world
";

var actual = (IDictionary<object, object>) deserializer.Deserialize<object>(yaml);
Assert.Equal("hello", ((IDictionary<object,object>)actual["a"])["Test"]);
Assert.Equal("world", ((IDictionary<object,object>)actual["b"])["Test"]);
}
}
[YamlSerializable]
public class RootObject
Expand Down

0 comments on commit 8255d17

Please sign in to comment.