Exemple #1
0
        public void TestSimpleProperties()
        {
            TestClassA a = new TestClassA
            {
                MyProperty = "string"
            };

            TestClassB b = a.Map <TestClassA, TestClassB>();

            Assert.Equal(a.MyProperty, b.MyProperty);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }