public void TestSaveUndoSaveRedo() { var actionStack = new TransactionalActionStack(5); using (var manager = new DirtiableManager(actionStack)) { var dirtiable = new SimpleDirtiable(); var action = new SimpleDirtiableActionItem(dirtiable.Yield()); actionStack.Add(action); Assert.AreEqual(true, dirtiable.IsDirty); actionStack.CreateSavePoint(true); manager.NotifySave(); Assert.AreEqual(false, dirtiable.IsDirty); actionStack.Undo(); Assert.AreEqual(true, dirtiable.IsDirty); actionStack.CreateSavePoint(true); manager.NotifySave(); Assert.AreEqual(false, dirtiable.IsDirty); actionStack.Redo(); Assert.AreEqual(true, dirtiable.IsDirty); actionStack.CreateSavePoint(true); manager.NotifySave(); Assert.AreEqual(false, dirtiable.IsDirty); } }
public void TestRedo() { var actionStack = new TransactionalActionStack(5); using (new DirtiableManager(actionStack)) { var dirtiable = new SimpleDirtiable(); var action = new SimpleDirtiableActionItem(dirtiable.Yield()); actionStack.Add(action); Assert.AreEqual(true, dirtiable.IsDirty); actionStack.Undo(); actionStack.Redo(); Assert.AreEqual(true, dirtiable.IsDirty); } }