Example #1
0
        public void MarsRoverTest_TopEdgeDirWest_MoveRight_RoverStepInBottomEdge()
        {
            IWorld world = WorldBuilder.GetDefault5x5World();

            Rover rover = new RoverBuilder()
                          .WithWorld(world)
                          .WithInitialDirectionWest()
                          .WithInitialPosition(0, world.GetTopEdgeYCoordinates())
                          .Build();

            rover.MoveRight();
            Assert.AreEqual(world.GetBottomEdgeYCoordinates(), rover.Position.Y);
        }
Example #2
0
        public void MarsRoverTest_RightEdgeDirNorth_MoveRight_RoverStepInLeftEdge()
        {
            IWorld world = WorldBuilder.GetDefault5x5World();

            Rover rover = new RoverBuilder()
                          .WithWorld(world)
                          .WithInitialDirectionNorth()
                          .WithInitialPosition(world.GetRightEdgeXCoordinates(), 3)
                          .Build();

            rover.MoveRight();
            Assert.AreEqual(world.GetLeftEdgeXCoordinates(), rover.Position.X);
        }
Example #3
0
        public void MarsRoverTest_InitialiPosition22South_MoveRight_FinalPosition12W()
        {
            IWorld world = WorldBuilder.GetDefault5x5World();

            Rover rover = new RoverBuilder()
                          .WithWorld(world)
                          .WithInitialDirectionSouth()
                          .WithInitialPosition(2, 2)
                          .Build();

            rover.MoveRight();

            Assert.AreEqual(1, rover.Position.X);
            Assert.AreEqual(2, rover.Position.Y);
            Assert.AreEqual(DirectionEnum.West, rover.Position.Direction);
        }