示例#1
0
        public void RunMarsRoverForInitialPosition12NAndCommandInstructionR()
        {
            roverCommands.Add(RoverCommand.Right);
            marsRover.Run(roverCommands);
            var mock = new MarsRoverPositionMock(1, 2, NavigationDirection.East);

            Assert.IsTrue(marsRover.GetCurrentPostionAndDirection().Equals(mock));
        }
示例#2
0
        public void Test_WontDriveOffPlateau()
        {
            var plateau    = new Plateau(5, 5);
            var coordinate = new Coordinate(0, 4);
            var direction  = DirectionParser.GetDirection('N');
            var rover      = new MarsRover(plateau, coordinate, direction);

            string command = "RM";

            rover.Run(command);

            Assert.AreEqual("1 4 E", rover.GetCurrentLocation());
        }
示例#3
0
        public void Test_Run_Multiple_Commands()
        {
            var plateau    = new Plateau(5, 5);
            var coordinate = new Coordinate(1, 2);
            var direction  = DirectionParser.GetDirection('N');
            var rover      = new MarsRover(plateau, coordinate, direction);

            string command = "LMLMLMLMM";

            rover.Run(command);

            Assert.AreEqual("1 3 N", rover.GetCurrentLocation());
        }
示例#4
0
        public void ValidateMarsRoverStopsAtMaxCoOrinatesOfPlateu()
        {
            MarsPlateu marsPlateu = new MarsPlateu(3, 3);
            MarsRover  marsRover  = MarsRover.CreateRover(new MarsRoverPositionMock(2, 2, NavigationDirection.North), marsPlateu);

            roverCommands.Add(RoverCommand.Move);
            roverCommands.Add(RoverCommand.Move);
            roverCommands.Add(RoverCommand.Right);
            roverCommands.Add(RoverCommand.Move);
            roverCommands.Add(RoverCommand.Move);
            marsRover.Run(roverCommands);
            var mock = new MarsRoverPositionMock(3, 3, NavigationDirection.East);

            Assert.IsTrue(marsRover.GetCurrentPostionAndDirection().Equals(mock));
        }