public void MarsRoverTest_ButtomEdgeDirSouth_MoveForward_RoverStepInTopEdge() { IWorld world = WorldBuilder.GetDefault5x5World(); Rover rover = new RoverBuilder() .WithWorld(world) .WithInitialDirectionSouth() .WithInitialPosition(0, world.GetBottomEdgeYCoordinates()) .Build(); rover.MoveForward(); Assert.AreEqual(world.GetTopEdgeYCoordinates(), rover.Position.Y); }
public void MarsRoverTest_RightEdgeDirEast_MoveForward_RoverStepInLeftEdge() { IWorld world = WorldBuilder.GetDefault5x5World(); Rover rover = new RoverBuilder() .WithWorld(world) .WithInitialDirectionEast() .WithInitialPosition(world.GetRightEdgeXCoordinates(), 3) .Build(); rover.MoveForward(); Assert.AreEqual(world.GetLeftEdgeXCoordinates(), rover.Position.X); }
public void MarsRoverTest_InitialPosition00N_MoveForward_FinalPosition01N() { IWorld world = WorldBuilder.GetDefault5x5World(); Rover rover = new RoverBuilder() .WithWorld(world) .WithInitialStateLeftBottomNorth() .Build(); rover.MoveForward(); Assert.AreEqual(rover.Position.X, 0); Assert.AreEqual(rover.Position.Y, 1); Assert.AreEqual(rover.Position.Direction, DirectionEnum.North); }
public void MarsRoverTest_InitialPosition00E_MoveForward_FinalPosition10E() { IWorld world = WorldBuilder.GetDefault5x5World(); Rover rover = new RoverBuilder() .WithWorld(world) .WithInitialStateLeftBottomEast() .Build(); rover.MoveForward(); Assert.AreEqual(1, rover.Position.X); Assert.AreEqual(0, rover.Position.Y); Assert.AreEqual(DirectionEnum.East, rover.Position.Direction); }
public void MarsRoverTest_InitialPosition22S_MoveForward_FinalPosition21S() { IWorld world = WorldBuilder.GetDefault5x5World(); Rover rover = new RoverBuilder() .WithWorld(world) .WithInitialDirectionSouth() .WithInitialPosition(2, 2) .Build(); rover.MoveForward(); Assert.AreEqual(rover.Position.X, 2); Assert.AreEqual(rover.Position.Y, 1); Assert.AreEqual(rover.Position.Direction, DirectionEnum.South); }