Пример #1
0
        public void RoverReportsObstacle()
        {
            Rover rover = MarsRover.Process(0, 0, Direction.North, new [] { 'f' }, 3, new [] { new Obstacle(0, 1) });

            Rover expectedRover = new Rover(0, 0, Direction.North, true);

            MarsRoverAsserts.AssertRoversEqual(expectedRover, rover);
        }
Пример #2
0
        public void ProcessesExtendedCommandSequenceWithWrap()
        {
            Rover rover = MarsRover.Process(0, 0, Direction.North, new [] { 'f', 'f', 'f', 'r', 'f', 'f', 'f', 'r', 'b' }, 3);

            Rover expectedRover = new Rover(3, -3, Direction.South, false);

            MarsRoverAsserts.AssertRoversEqual(expectedRover, rover);
        }
Пример #3
0
        public void WrapRoverMovement(Direction startDirection, int startX, int startY, Direction expectedDirection, int expectedX, int expectedY)
        {
            Rover rover = MarsRover.Process(startX, startY, startDirection, new [] { 'f' }, 3);

            Rover expectedRover = new Rover(expectedX, expectedY, expectedDirection);

            MarsRoverAsserts.AssertRoversEqual(expectedRover, rover);
        }
Пример #4
0
        public void RotateRover(Direction startDirection, char command, Direction expectedDirection)
        {
            Rover rover = MarsRover.Process(0, 0, startDirection, new [] { command });

            Rover expectedRover = new Rover(0, 0, expectedDirection);

            MarsRoverAsserts.AssertRoversEqual(expectedRover, rover);
        }
Пример #5
0
        public void MovesRoverBackward()
        {
            Rover rover = MarsRover.Process(0, 0, Direction.North, new [] { 'b', 'b' });

            Rover expectedRover = new Rover(0, -2, Direction.North);

            MarsRoverAsserts.AssertRoversEqual(expectedRover, rover);
        }
Пример #6
0
        public void ProcessesMultipleCommands()
        {
            Rover rover = MarsRover.Process(0, 0, Direction.North, new [] { 'f', 'f' });

            Rover expectedRover = new Rover(0, 2, Direction.North);

            MarsRoverAsserts.AssertRoversEqual(expectedRover, rover);
        }
Пример #7
0
        public void ProcessesExtendedCommandSequenceWithCrash()
        {
            Rover rover = MarsRover.Process(0, 0, Direction.North, new [] { 'f', 'f', 'f', 'l', 'f', 'f', 'f', 'r', 'b', 'b', 'b', }, 10, new [] { new Obstacle(-3, 0), new Obstacle(2, 2) });

            Rover expectedRover = new Rover(-3, 1, Direction.North, true);

            MarsRoverAsserts.AssertRoversEqual(expectedRover, rover);
        }
Пример #8
0
        public void MovesRoverDistance(Direction startDirection, int distance, int expectedX, int expectedY)
        {
            Rover startRover = new Rover(0, 0, startDirection);

            Rover rover = startRover.MoveDistance(distance);

            Rover expectedRover = new Rover(expectedX, expectedY, startDirection);

            MarsRoverAsserts.AssertRoversEqual(expectedRover, rover);
        }
Пример #9
0
        public void RoverRotatesRight(Direction startDirection, Direction expectedDirection)
        {
            Rover startRover = new Rover(0, 0, startDirection);

            Rover rover = startRover.RotateRight();

            Rover expectedRover = new Rover(0, 0, expectedDirection);

            MarsRoverAsserts.AssertRoversEqual(expectedRover, rover);
        }