Skip to content

Commit

Permalink
Fixed missing enum-value. (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdew authored and maximn committed Dec 4, 2019
1 parent 2dbf372 commit c01461f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
32 changes: 29 additions & 3 deletions GoogleMapsApi.Test/IntegrationTests/DirectionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DirectionsTests : BaseTestIntegration
public void Directions_SumOfStepDistancesCorrect()
{
var request = new DirectionsRequest { Origin = "285 Bedford Ave, Brooklyn, NY, USA", Destination = "185 Broadway Ave, Manhattan, NY, USA" };

request.ApiKey = ApiKey;
var result = GoogleMaps.Directions.Query(request);

AssertInconclusive.NotExceedQuota(result);
Expand Down Expand Up @@ -44,8 +44,7 @@ public void Directions_ErrorMessage()
[Test]
public void Directions_WithWayPoints()
{
var request = new DirectionsRequest { Origin = "NYC, USA", Destination = "Miami, USA", Waypoints = new string[] { "Philadelphia, USA" }, OptimizeWaypoints = true };

var request = new DirectionsRequest { Origin = "NYC, USA", Destination = "Miami, USA", Waypoints = new string[] { "Philadelphia, USA" }, OptimizeWaypoints = true, ApiKey = ApiKey };
var result = GoogleMaps.Directions.Query(request);

AssertInconclusive.NotExceedQuota(result);
Expand All @@ -54,6 +53,33 @@ public void Directions_WithWayPoints()

StringAssert.Contains("Philadelphia", result.Routes.First().Legs.First().EndAddress);
}
[Test]
public void Directions_ExceedingRouteLength()
{
var request = new DirectionsRequest
{
Origin = "NYC, USA", Destination = "Miami, USA", Waypoints = new string[]
{
"Seattle, USA",
"Dallas, USA",
"Naginey, USA",
"Edmonton, Canada",
"Seattle, USA",
"Dallas, USA",
"Naginey, USA",
"Edmonton, Canada",
"Seattle, USA",
"Dallas, USA",
"Naginey, USA",
"Edmonton, Canada"
},
ApiKey = ApiKey
};
var result = GoogleMaps.Directions.Query(request);

AssertInconclusive.NotExceedQuota(result);
Assert.AreEqual(DirectionsStatusCodes.MAX_ROUTE_LENGTH_EXCEEDED, result.Status, result.ErrorMessage);
}

[Test]
public void Directions_Correct_OverviewPath()
Expand Down
2 changes: 2 additions & 0 deletions GoogleMapsApi/Entities/Directions/Response/StatusCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public enum DirectionsStatusCodes
ZERO_RESULTS, // indicates no route could be found between the origin and destination.
[EnumMember]
MAX_WAYPOINTS_EXCEEDED, // indicates that too many waypointss were provided in the request The maximum allowed waypoints is 8, plus the origin, and destination. ( Google Maps Premier customers may contain requests with up to 23 waypoints.)
[EnumMember]
MAX_ROUTE_LENGTH_EXCEEDED, // indicates the requested route is too long and cannot be processed.
[EnumMember]
INVALID_REQUEST, // indicates that the provided request was invalid.
[EnumMember]
Expand Down

0 comments on commit c01461f

Please sign in to comment.