Beispiel #1
0
        public void CanCreateInstanceWithNestedData()
        {
            const int TEST_1 = 123;
            const int TEST_2 = 345;

            object      anon = new { Number = TEST_1, Nested = new { Number = TEST_2 } };
            NestingType data = (NestingType)DTOMapper.CreateFrom(typeof(NestingType), anon);

            // Make sure the props match.
            Assert.AreEqual(TEST_1, data.Number);
            Assert.AreEqual(TEST_2, data.Nested.Number);
            Assert.IsNull(data.Nested.Nested, "Nested 2x instance should be null!");
        }