public void ExecuteCommands() { // Arrange string test = string.Empty; string expected = "TSET"; IExecutor <string> executor = new Executor <string>(test); ICommand <string> append = new AppendTextCommand("test"); ICommand <string> toUpper = new ToUpperCommand(); ICommand <string> reverse = new ReverseCommand(); // Act executor.Do(append); executor.Do(toUpper); executor.Do(reverse); // Assert Assert.AreEqual(expected, executor.Target); }
public void RedoCommand() { // Arrange string test = string.Empty; string expected = "tset"; IExecutor <string> executor = new Executor <string>(test); ICommand <string> append = new AppendTextCommand("test"); ICommand <string> reverse = new ReverseCommand(); // Act executor.Do(append); executor.Redo(typeof(AppendTextCommand)); executor.Undo(typeof(AppendTextCommand)); executor.Undo(typeof(ReverseCommand)); executor.Undo(typeof(AppendTextCommand)); executor.Redo(typeof(AppendTextCommand)); executor.Do(reverse); // Assert Assert.AreEqual(expected, executor.Target); }