public void Control() { ManhattanLocation waypoint = new(10, 1); ManhattanLocation ship = new(); ship = FerryMover.MoveToWaypoint(waypoint, ship, 10); Assert.Equal(100, ship.HorizontalPosition); Assert.Equal(10, ship.VerticalPosition); waypoint.HorizontalPosition = 10; waypoint.VerticalPosition = 1; waypoint = FerryMover.MoveDirectionally(waypoint, 'N', 3); Assert.Equal(10, waypoint.HorizontalPosition); Assert.Equal(4, waypoint.VerticalPosition); ship = FerryMover.MoveToWaypoint(waypoint, ship, 7); Assert.Equal(170, ship.HorizontalPosition); Assert.Equal(38, ship.VerticalPosition); waypoint = FerryMover.RotateWaypoint(waypoint, Directive.ROTATE_RIGHT, 90); Assert.Equal(4, waypoint.HorizontalPosition); Assert.Equal(-10, waypoint.VerticalPosition); ship = FerryMover.MoveToWaypoint(waypoint, ship, 11); Assert.Equal(214, ship.HorizontalPosition); Assert.Equal(-72, ship.VerticalPosition); }
public void WaypointRotateLeft90From90() { ManhattanLocation waypoint = new(10, 4); waypoint = FerryMover.RotateWaypoint(waypoint, Directive.ROTATE_LEFT, 90); Assert.Equal(waypoint.HorizontalPosition, -4); Assert.Equal(waypoint.VerticalPosition, 10); }
public void WaypointRotateRight180From90() { ManhattanLocation waypoint = new(10, 4); waypoint = FerryMover.RotateWaypoint(waypoint, Directive.ROTATE_RIGHT, 180); Assert.Equal(waypoint.HorizontalPosition, -4); Assert.Equal(waypoint.VerticalPosition, -10); }