Exemple #1
0
 /**
  * Executes the List of turtle commands on this turtle
  *
  */
 public void Do(IList <TurtleCommand> turtleCommands)
 {
     foreach (TurtleCommand TurtleCommand in turtleCommands)
     {
         TurtleCommand.Execute(this);
     }
 }
Exemple #2
0
        public void TurtleIgnoringOtherCommandsBeforePlacedOnTable()
        {
            var turtleCommand = new TurtleCommand(5, 5);

            turtleCommand.Left();
            Assert.AreEqual(turtleCommand.CurrentDirection, null);
            Assert.AreEqual(turtleCommand.XCoOrdinate, null);
            Assert.AreEqual(turtleCommand.YCoOrdinate, null);
        }
Exemple #3
0
        public void TestCase1()
        {
            var turtleCommand = new TurtleCommand(5, 5);

            turtleCommand.Place(0, 0, Direction.North);
            turtleCommand.Move();
            var report = turtleCommand.Report();

            Assert.AreEqual(report.Item1, 0);
            Assert.AreEqual(report.Item2, 1);
            Assert.AreEqual(report.Item3, Direction.North);
        }
Exemple #4
0
        public void TestCase3()
        {
            var turtleCommand = new TurtleCommand(5, 5);

            turtleCommand.Place(1, 2, Direction.East);
            turtleCommand.Move();
            turtleCommand.Move();
            turtleCommand.Left();
            turtleCommand.Move();

            var report = turtleCommand.Report();

            Assert.AreEqual(report.Item1, 3);
            Assert.AreEqual(report.Item2, 3);
            Assert.AreEqual(report.Item3, Direction.North);
        }
        public void can_return_command_and_position_if_arguments_are_valid(string argumentTemplate, TurtleCommand command)
        {
            _turtleFilter.Execute(argumentTemplate);

            Assert.Equal(command, _turtleFilter.TurtleCommand);
        }
Exemple #6
0
        //======================================================

        /**
         * Executes the specified TurtleCommand on this Turtle
         */
        public void Do(TurtleCommand TurtleCommand)
        {
            TurtleCommand.Execute(this);
        }
 public void MapTurtleCommand(Char Char, TurtleCommand TurtleCommand)
 {
     CommandsMap.Add(Char, TurtleCommand);
 }