Example #1
0
        public void GoForwardButNowIsHeadingWestEdgeShouldThrowException()
        {
            IPosition position = new Position(0, 0);
            IHeading heading = new HeadingWest();
            IList<char> MovingInstruction = new List<char>();
            MovingInstruction.Add('M');

            var robot = new Robot(0, position, heading, MovingInstruction, _targetPlateau);
            robot.Move();
        }
        public void CorrectLandingPositionAndHeading()
        {
            IPosition position = new Position(1, 2);
            IHeading heading = new HeadingWest();
            IList<char> MovingInstruction = new List<char>();
            var plateau = new Plateau(5, 5);

            MovingInstruction.Add('L');

            var robot = new Robot(0, position, heading, MovingInstruction, plateau);
            Assert.AreEqual(1, robot.CurrentPosition.X);
            Assert.AreEqual(2, robot.CurrentPosition.Y);
            Assert.AreEqual(typeof (HeadingWest), robot.Heading.GetType());
        }
Example #3
0
        public void TurnRight()
        {
            IPosition position = new Position(1, 2);
            IHeading heading = new HeadingWest();
            IList<char> MovingInstruction = new List<char>();
            MovingInstruction.Add('R');

            var robot = new Robot(0, position, heading, MovingInstruction, _targetPlateau);
            robot.Move();

            Assert.AreEqual(1, robot.CurrentPosition.X);
            Assert.AreEqual(2, robot.CurrentPosition.Y);
            Assert.AreEqual(typeof (HeadingNorth), robot.Heading.GetType());
        }
Example #4
0
        public void InvalidMoveInstructionShouldThrowException()
        {
            IPosition position = new Position(1, 2);
            IHeading heading = new HeadingWest();
            IList<char> MovingInstruction = new List<char>();
            MovingInstruction.Add('T');

            var robot = new Robot(0, position, heading, MovingInstruction, _targetPlateau);
            robot.Move();
        }