Esempio n. 1
0
        public void TestChangeCommand()
        {
            //setup
            BaseExecuteCommand command1 = new ExecuteAt(new SharpCraft.Selector())
            {
                ExecuteCommand = new ExecuteAlign(true, true, true)
            };
            BaseExecuteCommand command2 = new ExecuteAt(new SharpCraft.Selector())
            {
                ExecuteCommand = new ExecuteAlign(true, true, true)
            };

            //test
            Assert.IsNull(command1.ChangeCommand(new ExecuteAs(ID.Selector.a)));
            Assert.IsFalse(command1.DoneChanging, "Adding another execute command shouldnt stop the changer");

            Assert.IsNull(command1.ChangeCommand(new SayCommand("hello")));
            Assert.IsTrue(command1.DoneChanging, "Adding an end command should stop the changer");

            Assert.IsNotNull(command1.ChangeCommand(new SayCommand("hello")));
            Assert.IsTrue(command1.DoneChanging, "Execute command ending in a command should stop the changer");

            Assert.IsNull(command2.ChangeCommand(new StopExecuteCommand()));
            Assert.IsTrue(command2.DoneChanging, "Execute command is not done executing after adding stop command");
        }