예제 #1
0
        public void Can_clone_DtoWithObjectList()
        {
            var expected = new DtoWithObjectList()
            {
                Id       = 1,
                Children = new[] { new DtoWithObjectList()
                                   {
                                       Id = 2, Children = new[] { new DtoWithObjectList() }
                                   } }
            };
            var clone = Incubator.Clone(expected);

            Assert.AreNotSame(expected, clone);
            Assert.AreNotSame(expected.Children, clone.Children);
            Assert.AreEqual(expected.Children.First().Id, clone.Children.First().Id);
            Assert.AreEqual(expected.Children.First().Children.First().Id, clone.Children.First().Children.First().Id);
        }
예제 #2
0
        public void Can_clone_DtoWithObjectList()
        {
            var expected = new DtoWithObjectList() {
                Id = 1,
                Children = new[] {new DtoWithObjectList() {
                    Id = 2, Children = new[] {new DtoWithObjectList()}
                }}
            };
            var clone = Incubator.Clone(expected);

            Assert.AreNotSame(expected, clone);
            Assert.AreNotSame(expected.Children, clone.Children);
            Assert.AreEqual(expected.Children.First().Id, clone.Children.First().Id);
            Assert.AreEqual(expected.Children.First().Children.First().Id, clone.Children.First().Children.First().Id);
        }