Add test for finding constructor

This commit is contained in:
Toru Higuruma 2017-08-18 16:33:42 +09:00
Родитель e1d07929b2
Коммит 2909b5d5f9
2 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@ -518,6 +518,24 @@ namespace SharedData
}
}
public class FindingConstructorCheck
{
public int MyProperty1 { get; set; }
public string MyProperty2 { get; set; }
public FindingConstructorCheck(KeyValuePair<int, string> ok)
{
}
public FindingConstructorCheck(int myProperty1, string myProperty2)
{
this.MyProperty1 = myProperty1;
this.MyProperty2 = myProperty2;
}
}
[MessagePackObject]
public class ArrayOptimizeClass
{

Просмотреть файл

@ -302,6 +302,17 @@ namespace MessagePack.Tests
re.MyProperty2.Is("hogehoge");
}
[Fact]
public void FindingConstructor()
{
var data = new FindingConstructorCheck(10, "hogehoge");
var bin = MessagePackSerializer.Serialize(data, DynamicContractlessObjectResolver.Instance);
var re = MessagePackSerializer.Deserialize<FindingConstructorCheck>(bin, MessagePack.Resolvers.DynamicContractlessObjectResolver.Instance);
re.MyProperty1.Is(10);
re.MyProperty2.Is("hogehoge");
}
[Fact]
public void NestedClass()
{