Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }