public void TestCollectionUpdate() { var so1 = new SimpleObject { ValueOne = 1, ValueTwo = 2 }; var so2 = new SimpleObject { ValueOne = 3, ValueTwo = 4 }; var co = new CollectionObject(); co.CollectionOne.Add(so1); var clone = (CollectionObject)CopyUtils.CloneObjectTest(co); clone.CollectionOne.Add(so2); Assert.AreNotSame(co, clone); Assert.AreSame(co.GetType(), clone.GetType()); Assert.AreNotSame(co.CollectionOne, clone.CollectionOne); Assert.AreNotEqual(co.CollectionOne.Count, clone.CollectionOne.Count); CopyUtils.UpdateFromClone(co, clone); Assert.AreNotSame(co, clone); Assert.AreSame(co.GetType(), clone.GetType()); Assert.AreNotSame(co.CollectionOne, clone.CollectionOne); Assert.AreEqual(co.CollectionOne.Count, clone.CollectionOne.Count); Assert.AreSame(co.CollectionOne.First(), clone.CollectionOne.First()); Assert.AreSame(co.CollectionOne.ElementAt(1), clone.CollectionOne.ElementAt(1)); }
public void TestCollectionClone() { var so = new SimpleObject {ValueOne = 1, ValueTwo = 2}; var co = new CollectionObject(); co.CollectionOne.Add(so); var clone = (CollectionObject) CopyUtils.CloneObjectTest(co); Assert.AreNotSame(co, clone); Assert.AreSame(co.GetType(), clone.GetType()); Assert.AreNotSame(co.CollectionOne, clone.CollectionOne); Assert.AreSame(co.CollectionOne.First(), clone.CollectionOne.First()); }
public void TestCollectionClone() { var so = new SimpleObject { ValueOne = 1, ValueTwo = 2 }; var co = new CollectionObject(); co.CollectionOne.Add(so); var clone = (CollectionObject)CopyUtils.CloneObjectTest(co); Assert.AreNotSame(co, clone); Assert.AreSame(co.GetType(), clone.GetType()); Assert.AreNotSame(co.CollectionOne, clone.CollectionOne); Assert.AreSame(co.CollectionOne.First(), clone.CollectionOne.First()); }
public void TestCollectionUpdate() { var so1 = new SimpleObject {ValueOne = 1, ValueTwo = 2}; var so2 = new SimpleObject {ValueOne = 3, ValueTwo = 4}; var co = new CollectionObject(); co.CollectionOne.Add(so1); var clone = (CollectionObject) CopyUtils.CloneObjectTest(co); clone.CollectionOne.Add(so2); Assert.AreNotSame(co, clone); Assert.AreSame(co.GetType(), clone.GetType()); Assert.AreNotSame(co.CollectionOne, clone.CollectionOne); Assert.AreNotEqual(co.CollectionOne.Count(), clone.CollectionOne.Count()); CopyUtils.UpdateFromClone(co, clone); Assert.AreNotSame(co, clone); Assert.AreSame(co.GetType(), clone.GetType()); Assert.AreNotSame(co.CollectionOne, clone.CollectionOne); Assert.AreEqual(co.CollectionOne.Count(), clone.CollectionOne.Count()); Assert.AreSame(co.CollectionOne.First(), clone.CollectionOne.First()); Assert.AreSame(co.CollectionOne.ElementAt(1), clone.CollectionOne.ElementAt(1)); }