Exemplo n.º 1
0
        public void Test_GetCurrentLocation()
        {
            var plateau    = new Plateau(5, 5);
            var coordinate = new Coordinate(3, 3);
            var direction  = DirectionParser.GetDirection('N');
            var rover      = new MarsRover(plateau, coordinate, direction);

            Assert.AreEqual("3 3 N", rover.GetCurrentLocation());
        }
Exemplo n.º 2
0
        public void Test_TurnRight()
        {
            var plateau    = new Plateau(5, 5);
            var coordinate = new Coordinate(1, 2);
            var direction  = DirectionParser.GetDirection('N');
            var rover      = new MarsRover(plateau, coordinate, direction);

            rover.TurnRight();

            Assert.AreEqual("1 2 E", rover.GetCurrentLocation());
        }
Exemplo n.º 3
0
        public void Test_MoveCommand()
        {
            var plateau    = new Plateau(5, 5);
            var coordinate = new Coordinate(1, 2);
            var direction  = DirectionParser.GetDirection('N');
            var rover      = new MarsRover(plateau, coordinate, direction);

            var moveCommand = new MoveCommand();

            moveCommand.Execute(rover);

            Assert.AreEqual("1 3 N", rover.GetCurrentLocation());
        }
Exemplo n.º 4
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());
        }
Exemplo n.º 5
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());
        }