Skip to content

Commit

Permalink
Add tes
Browse files Browse the repository at this point in the history
  • Loading branch information
jairbubbles committed Jul 15, 2021
1 parent 357e439 commit 3f3c232
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion YamlDotNet.Test/Serialization/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,14 @@ public void DontIgnoreExtraPropertiesIfWanted()
{
var text = Lines("aaa: hello", "bbb: world");
var actual = Record.Exception(() => Deserializer.Deserialize<Simple>(UsingReaderFor(text)));
Assert.IsType<YamlException>(actual);
Assert.IsType<PropertyNotFoundException>(actual);
((PropertyNotFoundException)actual).Start.Column.Should().Be(1);
((PropertyNotFoundException)actual).Start.Line.Should().Be(2);
((PropertyNotFoundException)actual).Start.Index.Should().Be(12);
((PropertyNotFoundException)actual).End.Column.Should().Be(4);
((PropertyNotFoundException)actual).End.Line.Should().Be(2);
((PropertyNotFoundException)actual).End.Index.Should().Be(15);
((PropertyNotFoundException)actual).Message.Should().EndWith("Property 'bbb' not found on type 'YamlDotNet.Test.Serialization.Simple'.");
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ public class MappingNodeTypeResolver : INodeTypeResolver

public MappingNodeTypeResolver(IDictionary<Type, Type> mappings)
{
if (mappings == null) throw new ArgumentNullException(nameof(mappings));
if (mappings == null)
{
throw new ArgumentNullException(nameof(mappings));
}

foreach (var pair in mappings)
{
Expand Down

0 comments on commit 3f3c232

Please sign in to comment.