From c01461ffb7a71cadcf4f69868754da4195459cc3 Mon Sep 17 00:00:00 2001 From: Peter de Witte Date: Wed, 4 Dec 2019 15:54:20 +0100 Subject: [PATCH] Fixed missing enum-value. (#137) --- .../IntegrationTests/DirectionsTests.cs | 32 +++++++++++++++++-- .../Directions/Response/StatusCodes.cs | 2 ++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/GoogleMapsApi.Test/IntegrationTests/DirectionsTests.cs b/GoogleMapsApi.Test/IntegrationTests/DirectionsTests.cs index 7b436ca..b61d496 100644 --- a/GoogleMapsApi.Test/IntegrationTests/DirectionsTests.cs +++ b/GoogleMapsApi.Test/IntegrationTests/DirectionsTests.cs @@ -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); @@ -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); @@ -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() diff --git a/GoogleMapsApi/Entities/Directions/Response/StatusCodes.cs b/GoogleMapsApi/Entities/Directions/Response/StatusCodes.cs index b62eb11..0672e3d 100644 --- a/GoogleMapsApi/Entities/Directions/Response/StatusCodes.cs +++ b/GoogleMapsApi/Entities/Directions/Response/StatusCodes.cs @@ -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]