示例#1
0
        public void TestCopyToExistingObject()
        {
            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 = new TestClassB();

            a.MapTo(b);
            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);
        }
示例#2
0
        public void MapTo_NullSource_Throws_3()
        {
            TestClassA source = null;

            source.MapTo <TestClassB>(A.Fake <IMapper>());
        }
示例#3
0
        public void MapTo_NullSource_Throws_2()
        {
            TestClassA source = null;

            source.MapTo <TestClassB>();
        }
示例#4
0
        public void MapTo_NullSource_Throws_1()
        {
            TestClassA source = null;

            source.MapTo(new TestClassB());
        }
示例#5
0
        public void MapTo_NullSource_Throws_5()
        {
            TestClassA source = null;

            source.MapTo(new TestClassB(), A.Fake <IMapper>());
        }
示例#6
0
        public void MapTo_NullSource_Throws_4()
        {
            TestClassA source = null;

            source.MapTo <TestClassB>(A.Fake <IMappingRepository>());
        }