Esempio n. 1
0
        public void cannot_move_rover()
        {
            var rover = new Rover(new Coordinate(0, 0), CameraDirection.West);
            rover.OnMoving(c => false);

            Assert.Throws<RoverCannotMoveException>(() => rover.SendInstruction(RoverInstruction.M));
        }
Esempio n. 2
0
        public void cannot_move_rover_outside_of_plateau(int x, int y, CameraDirection cameraDirection)
        {
            var mars = new Plateau(new Size(1, 1));
            var rover = new Rover(new Coordinate(x, y), cameraDirection);
            mars.PlaceRover(rover);

            Assert.Throws<RoverCannotMoveException>(() => rover.SendInstruction(RoverInstruction.M));
        }
Esempio n. 3
0
        public void moves_west()
        {
            var rover = new Rover(new Coordinate(1, 0), CameraDirection.West);

            rover.SendInstruction(RoverInstruction.M);

            Assert.AreEqual(new Coordinate(0, 0), rover.Coordinate);
        }
Esempio n. 4
0
        public void moves_south()
        {
            var rover = new Rover(new Coordinate(0, 1), CameraDirection.South);

            rover.SendInstruction(RoverInstruction.M);

            Assert.AreEqual(new Coordinate(0, 0), rover.Coordinate);
        }
Esempio n. 5
0
        public void changes_direction(RoverInstruction instruction, CameraDirection initialDirection, CameraDirection expectedDirection)
        {
            var rover = new Rover(new Coordinate(0, 0), initialDirection);

            rover.SendInstruction(instruction);

            Assert.AreEqual(expectedDirection, rover.CameraDirection);
        }
Esempio n. 6
0
        public void cannot_move_rover_if_it_will_collide_with_another_rover()
        {
            var mars = new Plateau(new Size(3, 3));
            var rover = new Rover(new Coordinate(1, 1), CameraDirection.North);
            mars.PlaceRover(rover);

            var rover2 = new Rover(new Coordinate(1, 2), CameraDirection.South);
            mars.PlaceRover(rover2);

            Assert.Throws<RoverCannotMoveException>(() => rover2.SendInstruction(RoverInstruction.M));
        }