Default values in constructor doesn't work
nicloay opened this issue · 1 comments
nicloay commented
with following configuration Test is not passed
public partial class DefaultValue
{
public readonly int Value;
public readonly int ValueSet;
[YamlConstructor]
public DefaultValue(int valueSet, int value = 12)
{
ValueSet = valueSet;
Value = value;
}
}
and this test is failing
public void TestDefaultValue()
{
string testYaml = @"---
valueSet: 22";
var deserialized = YamlSerializer.Deserialize<DefaultValue>(Encoding.UTF8.GetBytes(testYaml));
Assert.That(deserialized.ValueSet, Is.EqualTo(22));
Assert.That(deserialized.Value, Is.EqualTo(12));
}
TestDefaultValue (0,046s)
Expected: 12
But was: 0