示例#1
0
        public void Can_clone_DtoWithObjectEnumerable()
        {
            var expected = new DtoWithObjectEnumerable()
            {
                Id       = 1,
                Children = new[] { new DtoWithObjectEnumerable()
                                   {
                                       Id = 2, Children = new[] { new DtoWithObjectEnumerable() }
                                   } }
            };
            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_DtoWithObjectEnumerable()
        {
            var expected = new DtoWithObjectEnumerable() {
                Id = 1,
                Children = new[] {new DtoWithObjectEnumerable() {
                    Id = 2, Children = new[] {new DtoWithObjectEnumerable()}
                }}
            };
            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);
        }