public void PositionGivenZeroZeroSRotatedLFacesE() { var position = new Position(0, 0, Orientation.S); position.Rotate(Direction.L); Assert.AreEqual(Orientation.E, position.Facing); }
public void PositionGivenZeroZeroNConstructsCorrectly() { var position = new Position(0, 0, Orientation.N); Assert.AreEqual(position.X, 0); Assert.AreEqual(position.Y, 0); Assert.AreEqual(Orientation.N, position.Facing); }
public void PositionGivenFiveFiveSConstructsCorrectly() { var position = new Position(5, 5, Orientation.S); Assert.AreEqual(position.X, 5); Assert.AreEqual(position.Y, 5); Assert.AreEqual(Orientation.S, position.Facing); }
public void PositionGivenZeroZeroNMovedOnceReturnsZeroOneN() { var position = new Position(0, 0, Orientation.N); position.Move(); Assert.AreEqual(0, position.X); Assert.AreEqual(1, position.Y); Assert.AreEqual(Orientation.N, position.Facing); }
public void PositionGivenOneOneWMovedOnceReturnsZeroOneW() { var position = new Position(1, 1, Orientation.W); position.Move(); Assert.AreEqual(0, position.X); Assert.AreEqual(1, position.Y); Assert.AreEqual(Orientation.W, position.Facing); }
public void RoverStartingAtZeroZeroNGivenRFacesE() { var start = new Position(0, 0, Orientation.N); var rover = new Rover(start); rover.Go("R"); Assert.AreEqual(Orientation.E, rover.Position.Facing); }
public void RoverStartingAtZeroZeroNGivenMFinishesAtZeroOne() { var start = new Position(0, 0, Orientation.N); var rover = new Rover(start); rover.Go("M"); Assert.AreEqual(0, rover.Position.X); Assert.AreEqual(1, rover.Position.Y); }
public void RoverStartingAtZeroZeroNGivenRMMLMFinishesAtTwoOneFacingN() { var start = new Position(0, 0, Orientation.N); var rover = new Rover(start); rover.Go("RMMLM"); Assert.AreEqual(2, rover.Position.X); Assert.AreEqual(1, rover.Position.Y); Assert.AreEqual(Orientation.N, rover.Position.Facing); }
public void PositionGivenZeroZeroWRotatedLLLLFacesW() { var position = new Position(0, 0, Orientation.W); for (int i = 0; i < 4; i++) { position.Rotate(Direction.L); } Assert.AreEqual(Orientation.W, position.Facing); }
public void PositionGivenZeroZeroNRotatedRRRRFacesN() { var position = new Position(0, 0, Orientation.N); for (int i = 0; i < 4; i++) { position.Rotate(Direction.R); } Assert.AreEqual(Orientation.N, position.Facing); }
public Rover(Position start) { this.Position = start; }