Skip to content

Commit

Permalink
Add failing test for aaubry#360
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechNagorski committed Oct 26, 2018
1 parent 01e1f09 commit bfc2ed0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions YamlDotNet.Test/Serialization/SerializationTestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,4 +530,14 @@ public class NameConvention
[YamlIgnore]
public string fourthTest { get; set; }
}

public struct SimpleStruct
{
public int Value { get; set; }
}

public class ClassWithNullableStruct
{
public SimpleStruct? Struct { get; set; }
}
}
11 changes: 11 additions & 0 deletions YamlDotNet.Test/Serialization/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,17 @@ public void DeserializationOfObjectsHandlesForwardReferences()
new { Nothing = "ForwardReference", MyString = "ForwardReference" }, o => o.ExcludingMissingMembers());
}

[Fact]
public void SerializeAndDesierializeClassWithNullableStruct()
{
var yaml = Serializer.Serialize(new ClassWithNullableStruct
{
Struct = new SimpleStruct { Value = 42 }
});

var i = Deserializer.Deserialize<ClassWithNullableStruct>(yaml);
}

[Fact]
public void DeserializationFailsForUndefinedForwardReferences()
{
Expand Down

0 comments on commit bfc2ed0

Please sign in to comment.