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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }