Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void ChangeNodeTextUndoBeforeExecute()
        {
            IRootCauseCommand command = new ChangeNodeTextCommand(new NullDb(), problem, "New Text");

            command.Undo();
        }
Esempio n. 3
0
        public void ChangeNodeTextTwice()
        {
            IRootCauseCommand command = new ChangeNodeTextCommand(new NullDb(), problem, "New Text", true);

            command.Execute();
        }