public void EditExecutesCommand() { var command = new ChangeHeightCommand(shape, 10); commandProcessor.Do(command); Assert.AreEqual(10, shape.Height); }
public void EditEnablesUndo() { var command = new ChangeHeightCommand(shape, 10); commandProcessor.Do(command); Assert.IsTrue(commandProcessor.CanUndo()); }
public void MultipleRedos() { var command = new ChangeHeightCommand(shape, 10); ChangeHeightManyTimes(commandProcessor, shape, 10); UndoMany(commandProcessor, 5); RedoMany(commandProcessor, 3); Assert.AreEqual(70, shape.Height); }
public void AfterNewEditRedoIsDisabled() { var command = new ChangeHeightCommand(shape, 10); ChangeHeightManyTimes(commandProcessor, shape, 10); UndoMany(commandProcessor, 3); commandProcessor.Do(new ChangeWidthCommand(shape, 100)); Assert.IsFalse(commandProcessor.CanRedo()); }
public ChangeHeightCommandTests() { shape = new Shape(); shape.Height = 10; changeHeightCommand = new ChangeHeightCommand(shape, 50); }
private void ChangeHeightManyTimes(CommandProcessor editor, Shape shape, Int32 numberOfTimes) { for (var i = 0; i < numberOfTimes; i++) { var command = new ChangeHeightCommand(shape, i * 10); editor.Do(command); } }
public void UndoWithOneCommandEnablesRedo() { var command = new ChangeHeightCommand(shape, 10); commandProcessor.Do(command); commandProcessor.Undo(); Assert.IsTrue(commandProcessor.CanRedo()); }
public void UndoWithOneCommandDisablesUndo() { var command = new ChangeHeightCommand(shape, 10); commandProcessor.Do(command); commandProcessor.Undo(); Assert.IsFalse(commandProcessor.CanUndo()); }
public void UndoRedoIsDisabledBeforeEdit() { var command = new ChangeHeightCommand(shape, 10); Assert.IsFalse(commandProcessor.CanRedo()); Assert.IsFalse(commandProcessor.CanUndo()); }
public void RedoCallsUnexecute() { var command = new ChangeHeightCommand(shape, 10); commandProcessor.Do(command); commandProcessor.Undo(); commandProcessor.Redo(); Assert.AreEqual(10, shape.Height); }