public void TestUndoRedoTwoTimesIsUndoableRedoable() { UndoRedoList sut = new UndoRedoList(); sut.Add(NoAction, NoAction); Assert.That(sut.IsUndoActive); Assert.That(sut.UndoCount, Is.EqualTo(1)); sut.Undo(); Assert.That(sut.IsUndoActive, Is.False); Assert.That(sut.UndoCount, Is.EqualTo(0)); Assert.That(sut.IsRedoActive); Assert.That(sut.RedoCount, Is.EqualTo(1)); sut.Redo(); Assert.That(sut.IsUndoActive); Assert.That(sut.UndoCount, Is.EqualTo(1)); Assert.That(sut.IsRedoActive, Is.False); Assert.That(sut.RedoCount, Is.EqualTo(0)); }
public void TestUndoRedoTwoTimes() { Action undo = mockRepo.CreateMock<Action>(); Action redo = mockRepo.CreateMock<Action>(); Expect.Call(() => undo()).Repeat.Twice(); Expect.Call(() => redo()).Repeat.Twice(); mockRepo.ReplayAll(); UndoRedoList sut = new UndoRedoList(); sut.Add(undo, redo); sut.Undo(); sut.Redo(); sut.Undo(); sut.Redo(); }
public void TestRedoableWhenUndo() { UndoRedoList sut = new UndoRedoList(); sut.Add(NoAction, NoAction); sut.Undo(); Assert.That(sut.IsRedoActive, Is.True); }
public void TestRedoListCount() { UndoRedoList sut = new UndoRedoList(); sut.Add(NoAction, NoAction); sut.Add(NoAction, NoAction); sut.Add(NoAction, NoAction); sut.Undo(); sut.Undo(); Assert.That(sut.RedoCount, Is.EqualTo(2)); }
public void TestBasicUndo() { Action act = mockRepo.CreateMock<Action>(); act(); mockRepo.ReplayAll(); UndoRedoList sut = new UndoRedoList(); sut.Add(act, null); sut.Undo(); }