Exemple #1
0
 public void Test_ValidRoverPosition()
 {
     position = new Coords(0, 0);
     rover    = new Rover(plateau, position, CardinalDirection.North);
     rover.SetPosition(5, 5, CardinalDirection.East);
     Assert.IsTrue(rover.GetPosition().X == 5, "X must be 5");
     Assert.IsTrue(rover.GetPosition().Y == 5, "Y must be 5");
     Assert.IsTrue(rover.GetDirection() == CardinalDirection.East, "Direction must be E");
 }
Exemple #2
0
        public void MoveBackward(int initialX, int initialY, char initialDirection, int expectedX, int expectedY, char expectedDirection)
        {
            var coordinate = new Coordinate(initialX, initialY);
            var world      = new World(5, 5);
            var rover      = new Rover(coordinate, initialDirection, world);

            rover.MoveBackward();

            Assert.Equal(expectedX, rover.GetCoordinate().GetXCoordinate());
            Assert.Equal(expectedY, rover.GetCoordinate().GetYCoordinate());
            Assert.Equal(expectedDirection, rover.GetDirection());
        }
Exemple #3
0
        public void TurnLeft(char initialDirection, char expectedDirection)
        {
            const int xCoordinate = 2;
            const int yCoordinate = 2;
            var       coordinate  = new Coordinate(xCoordinate, yCoordinate);
            var       world       = new World(5, 5);
            var       rover       = new Rover(coordinate, initialDirection, world);

            rover.TurnLeft();

            Assert.Equal(xCoordinate, rover.GetCoordinate().GetXCoordinate());
            Assert.Equal(yCoordinate, rover.GetCoordinate().GetYCoordinate());
            Assert.Equal(expectedDirection, rover.GetDirection());
        }
Exemple #4
0
        public void Test_TurnRight_One_Once()
        {
            rover.RunCommands("R");
            Coords            coords    = rover.GetPosition();
            CardinalDirection direction = rover.GetDirection();

            Assert.IsTrue(coords.X == position.X && coords.Y == position.Y, "Position must be 0,0");
            Assert.IsTrue(direction == CardinalDirection.East, "Direction must be E");
        }