public void UnlimitedNestingDepthWorksAsExpected() { var mapper = new MemberMapper(); var nested = new NestedA { Bar = "A", Nested = new NestedB { Bar = "B", Nested = new[] { new NestedC { Bar = "C", Nested = new NestedD { Bar = "D" } } } } }; mapper.Options.Cloning.MaxCloneDepth = null; var clone = mapper.DeepClone(nested); Assert.IsNotNull(clone.Nested); Assert.IsNotNull(clone.Nested.Nested); Assert.IsNotNull(clone.Nested.Nested.Single().Nested); }
public void DefaultNestingDepthWorksAsExpected() { var mapper = new MemberMapper(); var nested = new NestedA { Bar = "A", Nested = new NestedB { Bar = "B", Nested = new[] { new NestedC { Bar = "C", Nested = new NestedD { Bar = "D" } } } } }; var clone = mapper.DeepClone(nested); Assert.IsNotNull(clone.Nested); Assert.IsNotNull(clone.Nested.Nested); Assert.IsNull(clone.Nested.Nested.Single().Nested); }
public void ChangedNestingDepthWorksAsExpected() { var mapper = new MemberMapper(); var nested = new NestedA { Bar = "A", Nested = new NestedB { Bar = "B", Nested = new[] { new NestedC { Bar = "C", Nested = new NestedD { Bar = "D" } } } } }; mapper.Options.Cloning.MaxCloneDepth = 1; var clone = mapper.DeepClone(nested); Assert.IsNotNull(clone.Nested); Assert.IsNull(clone.Nested.Nested); }
public override bool Equals(object obj) { NestedA other = obj as NestedA; if (other == null) { return(false); } return(NestedBList.SequenceEqual(other.NestedBList) && NestedCList.SequenceEqual(other.NestedCList)); }