public void ParseOrientation_WhenPassedValidDirection_ShouldParse() { var coord = "1 4 N"; var expected = Orientation.North; var actual = RoverController.ParseOrientation(coord); Assert.AreEqual(expected, actual); }
public Rover(string position, Plateau plateau) { Coordinate = RoverController.ParseCoordinate(position); if (Coordinate.X > plateau.TopRight.X || Coordinate.Y > plateau.TopRight.Y || Coordinate.Y < 0 || Coordinate.X < 0) { throw new ArgumentOutOfRangeException(nameof(position), "Rover out of range of the plateau graph."); } Orientation = RoverController.ParseOrientation(position); }
public void ParseOrientation_WhenPassedInvalidDirection_ShouldThrow() { var coord = "1 2 B"; Assert.ThrowsException <ArgumentException>(() => RoverController.ParseOrientation(coord)); }
public void ParseOrientation_WhenPassedEmptyString_ShouldThrow() { Assert.ThrowsException <ArgumentException>(() => RoverController.ParseOrientation("")); }