Пример #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>());
        }