public void ChangeNodeTextAndUndo() { AddNodeCommand addCommand = new AddNodeCommand(new NullDb(), problem, "Child 1", true); addCommand = new AddNodeCommand(new NullDb(), problem, "Child 2"); Node node = new AddNodeCommand(new NullDb(), problem, "Child 2", true).NewNode; ChangeNodeTextCommand txtCommand = new ChangeNodeTextCommand(new NullDb(), node, "Child 2"); Assert.AreEqual("Child 2", node.Text); txtCommand.Execute(); Assert.AreEqual("Child 2", node.Text); txtCommand = new ChangeNodeTextCommand(new NullDb(), node, "Child 3"); Assert.AreEqual("Child 2", node.Text); txtCommand.Execute(); Assert.AreEqual("Child 3", node.Text); Assert.AreEqual(true, txtCommand.Executed); txtCommand.Undo(); Assert.AreEqual("Child 2", node.Text); Assert.AreEqual(false, txtCommand.Executed); }
public void ChangeNodeTextUndoBeforeExecute() { IRootCauseCommand command = new ChangeNodeTextCommand(new NullDb(), problem, "New Text"); command.Undo(); }
public void ChangeNodeTextTwice() { IRootCauseCommand command = new ChangeNodeTextCommand(new NullDb(), problem, "New Text", true); command.Execute(); }