Exemplo n.º 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();
        }
Exemplo n.º 2
0
        public void GoForwardToEast()
        {
            IPosition position = new Position(1, 2);
            IHeading heading = new HeadingEast();
            IList<char> MovingInstruction = new List<char>();
            MovingInstruction.Add('M');

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

            Assert.AreEqual(2, robot.CurrentPosition.X);
            Assert.AreEqual(2, robot.CurrentPosition.Y);
            Assert.AreEqual(typeof(HeadingEast), robot.Heading.GetType());
        }
        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());
        }
Exemplo n.º 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();
        }