public void RedoShouldExecuteUndoneCommand() { var command = Substitute.For <ICommand>(); var reverseCommand = Substitute.For <ICommand>(); var reverseReverseCommand = Substitute.For <ICommand>(); command.GetReverseCommand().Returns(reverseCommand); reverseCommand.GetReverseCommand().Returns(reverseReverseCommand); var outline = new Outline(); var co = new CommandOutline(outline); co.RunCommand(command); co.Undo(); co.Redo(); reverseReverseCommand.Received(1).Do(outline); }
public void NewCommandShouldClearRedos() { var command = Substitute.For <ICommand>(); var reverseCommand = Substitute.For <ICommand>(); var reverseReverseCommand = Substitute.For <ICommand>(); command.GetReverseCommand().Returns(reverseCommand); reverseCommand.GetReverseCommand().Returns(reverseReverseCommand); var outline = new Outline(); var co = new CommandOutline(outline); co.RunCommand(command); co.Undo(); co.RunCommand(Substitute.For <ICommand>()); co.Redo(); reverseReverseCommand.Received(0).Do(outline); }