public void TestSimpleProperties() { TestClassA a = new TestClassA { MyProperty = "string" }; TestClassB b = a.Map <TestClassA, TestClassB>(); Assert.Equal(a.MyProperty, b.MyProperty); }
public void TestEnumableProperties() { TestClassA a = new TestClassA() { TestClassC = new TestClassC() { MyProperty = "string" }, List = new List <TestClassC>() { new TestClassC() { MyProperty = "cstring" }, new TestClassC() { MyProperty = "cstring" }, }, MyProperty = "string", Array = new[] { new TestClassC() { MyProperty = "string", Obj = new TestClassD() { MyProperty = "sstring" } }, new TestClassC() { MyProperty = "string", Obj = new TestClassD() { MyProperty = "sstring" } }, } }; var b = a.Map <TestClassA, TestClassB>(); Assert.Equal(a.MyProperty, b.MyProperty); Assert.Equal(a.TestClassC.MyProperty, b.TestClassC.MyProperty); Assert.Equal(a.List.Count, b.List.Count); Assert.Equal(a.Array.Length, b.Array.Length); }
public void TestRefTypeProperties() { TestClassA a = new TestClassA() { TestClassC = new TestClassC() { MyProperty = "string" }, List = new List <TestClassC>() { new TestClassC() { MyProperty = "cstring" } } }; var b = a.Map <TestClassA, TestClassB>(); Assert.Equal(a.MyProperty, b.MyProperty); Assert.Equal(a.TestClassC.MyProperty, b.TestClassC.MyProperty); Assert.Equal(a.List.Count, b.List.Count); }