Esempio n. 1
0
        public void Test_NavigationService_Moves_Rover_Correctly_Forward_Multiple_Square()
        {
            INavigationService service = new NavigationService();
            Plateau plateau = new Plateau(5, 5);
            List<Command> commands = new List<Command>();

            commands.Add(Command.MoveForward);
            commands.Add(Command.MoveForward);
            commands.Add(Command.MoveForward);
            commands.Add(Command.MoveForward);
            commands.Add(Command.MoveForward);

            var startPosition = new Position { Direction = Direction.North, X = 0, Y = 0 };
            var expectedPosition = new Position { Direction = Direction.North, X = 0, Y = 5 };
            var rover = new Rover(startPosition);

            Position position = service.ExploreTerrain(plateau, rover, commands);
            Assert.AreEqual(position, expectedPosition);
        }
Esempio n. 2
0
        public void Test_NavigationService_Moves_Rover_Correctly_According_To_Supplied_Test_Data_Two()
        {
            INavigationService service = new NavigationService();
            Plateau plateau = new Plateau(5, 5);
            List<Command> commands = new List<Command>();

            commands.Add(Command.MoveForward);
            commands.Add(Command.MoveForward);
            commands.Add(Command.TurnRight);
            commands.Add(Command.MoveForward);
            commands.Add(Command.MoveForward);
            commands.Add(Command.TurnRight);
            commands.Add(Command.MoveForward);
            commands.Add(Command.TurnRight);
            commands.Add(Command.TurnRight);
            commands.Add(Command.MoveForward);

            var startPosition = new Position { Direction = Direction.East, X = 3, Y = 3 };
            var expectedPosition = new Position { Direction = Direction.East, X = 5, Y = 1 };
            var rover = new Rover(startPosition);

            Position position = service.ExploreTerrain(plateau, rover, commands);
            Assert.AreEqual(position, expectedPosition);
        }