Example #1
0
        public void CanRedoTest_NAK()
        {
            MockUndo m1 = new MockUndo(true);
            MockUndo m2 = new MockUndo(false);

            UndoOperationSet target = new UndoOperationSet();

            target.Add(m1);
            target.Add(m2);

            Assert.IsFalse(target.CanRedo);
        }
Example #2
0
        public void RedoTest()
        {
            MockUndo m1 = new MockUndo(true);
            MockUndo m2 = new MockUndo(true);

            UndoOperationSet target = new UndoOperationSet();

            target.Add(m1);
            target.Add(m2);

            target.Redo();
            Assert.IsTrue(m1.redoCalled);
            Assert.IsTrue(m2.redoCalled);
        }
Example #3
0
        public void UndoOrderTest()
        {
            int      finalValue = 0;
            MockUndo m1         = new MockUndo(true);

            UndoOperationSet target = new UndoOperationSet();

            target.Add(m1);
            target.Add(new DelegateUndo(() => finalValue = 1));
            target.Add(new DelegateUndo(() => finalValue = 2));

            target.Undo();

            Assert.IsTrue(m1.undoCalled);
            Assert.AreEqual(1, finalValue);
        }