public void BeginEdit_And_Cancel() { var user = new UserEditable { FirstName = "Marie", LastName = "Bellin" }; user.BeginEdit(); user.FirstName = "updated firstname"; user.LastName = "updated lastname"; user.CancelEdit(); Assert.AreEqual("Marie", user.FirstName); Assert.AreEqual("Bellin", user.LastName); }
public void TestEditAndRestore() { var editor = new ObjectEditor(); var user = new UserEditable { FirstName = "Marie", LastName = "Bellin" }; Assert.AreEqual(false, editor.CanRestore); editor.Store(user); Assert.AreEqual(true, editor.CanRestore); user.FirstName = "updated firstname"; user.LastName = "updated lastname"; editor.Restore(); Assert.AreEqual("Marie", user.FirstName); Assert.AreEqual("Bellin", user.LastName); }
public void Ignore_Property() { var editor = new ObjectEditor(new List <string> { "FirstName" }); var user = new UserEditable { FirstName = "Marie", LastName = "Bellin" }; Assert.AreEqual(false, editor.CanRestore); editor.Store(user); Assert.AreEqual(true, editor.CanRestore); user.FirstName = "updated firstname"; user.LastName = "updated lastname"; editor.Restore(); Assert.AreEqual("updated firstname", user.FirstName); Assert.AreEqual("Bellin", user.LastName); }