public void TestGetOldValue() { var customer = new CustomerTest { ID = 1, Name = "Test", Address = "London" }; customer.AcceptChanges(); customer.Name = "Modified"; var old = customer.GetOldValue(x => x.Name); Assert.IsTrue(old.ToString() == "Test"); customer.AcceptChanges(); old = customer.GetOldValue(x => x.Name); Assert.IsTrue(old.ToString() == "Modified"); }
public void TestRollback() { var customer = new CustomerTest { ID = 1, Name = "Test", Address = "London" }; customer.AcceptChanges(); customer.Name = "Modified"; customer.RejectChanges(); Assert.IsTrue(customer.Name == "Test"); }
public void TestGetChangedProperties() { var customer = new CustomerTest { ID = 1, Name = "Test", Address = "London" }; customer.AcceptChanges(); customer.Name = "Modified"; var changes = customer.GetChangedProperties(); Assert.IsTrue(changes.Count == 1); Assert.IsTrue(changes[0] == nameof(customer.Name)); }