Esempio n. 1
0
        public void ComplexMixinsCanMap()
        {
            var source = new Whole
            {
                Part = new Part { Name = "part1" },
                Parts = new List<Part> { new Part { Name = "part2" }, new Part { Name = "part3" } }
            };

            var destination = new Whole();
            source.MapTo(destination);
            Assert.IsTrue(source.EqualsByValue(destination));
        }
Esempio n. 2
0
        public void ComplexMixinsCanMapToOtherComplexMixins()
        {
            var source = new Whole
            {
                Part = new Part { Name = "part1" },
                Parts = new[] { new Part { Name = "part2" }, new Part { Name = "part3" } }
            };

            var destination = new VievModel();
            source.MapTo(destination, deep: true);
            Assert.AreNotSame(source.Part, destination.Part);
            Assert.AreEqual(source.Part.Name, destination.Part.Name);
            Assert.AreNotSame(source.Parts, destination.Parts);
            Assert.AreEqual(source.Parts.Count(), destination.Parts.Count());
            Assert.AreEqual(source.Parts.First().Name, destination.Parts.First().Name);
            Assert.AreEqual(source.Parts.Last().Name, destination.Parts.Last().Name);
        }