Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
 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);
     }
 }
Exemple #4
0
 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);
     }
 }