public void MemoryCloneTest() { var sample1 = new SampleEntity(); sample1.SetStateChanged(); var sample2 = CloneUtil.MemoryClone(sample1) as SampleEntity; Assert.AreEqual(sample1.Id, sample2.Id); Assert.AreEqual(sample1.Name, sample2.Name); Assert.AreEqual(sample1.IsStateChanged, sample2.IsStateChanged); sample2.Id = sample1.Id + 1; sample2.Name = "John"; Assert.AreNotEqual(sample1.Id, sample2.Id); Assert.AreNotEqual(sample1.Name, sample2.Name); }
public void ResetStateChangedTest() { var sample = new SampleEntity(); sample.SetStateChanged(); Assert.IsTrue(sample.IsStateChanged); StateUtil.ResetStateChanged(sample); Assert.IsFalse(sample.IsStateChanged); var root = new RootEntity(); root.SetStateChanged(); root.Sample = new SampleEntity(); root.Sample.SetStateChanged(); Assert.IsTrue(root.IsStateChanged); Assert.IsTrue(root.Sample.IsStateChanged); StateUtil.ResetStateChanged(root); Assert.IsFalse(root.IsStateChanged); Assert.IsFalse(root.Sample.IsStateChanged); }