public void TrackObjectPropertyValues() { var item = new MyTrackedItem { MyInt = 10, MyString = "My string value" }; var tracker = new ChangeTracker(); tracker.TrackChanges(item); Assert.IsFalse(tracker.CheckChanges()); // change item.MyString = "New Value"; Assert.IsTrue(tracker.CheckChanges()); // back item.MyString = "My string value"; Assert.IsFalse(tracker.CheckChanges()); }
public void Ignore_Property() { var item = new MyTrackedItem { MyInt = 10, MyString = "My string value" }; var tracker = new ChangeTracker(new List <string> { "MyInt" }); tracker.TrackChanges(item); Assert.IsFalse(tracker.CheckChanges()); // change item.MyInt = 100; Assert.IsFalse(tracker.CheckChanges()); // back item.MyString = "My new value"; Assert.IsTrue(tracker.CheckChanges()); }