Skip to content

Commit

Permalink
Merge pull request #389 from valchetski/master
Browse files Browse the repository at this point in the history
Mode parameter lower-case in Distance Matrix
  • Loading branch information
vivet authored May 1, 2024
2 parents 0720967 + 73c731c commit b34092f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .tests/GoogleApi.Test/Maps/DistanceMatrix/DistanceMatrixTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,42 @@ public async Task DistanceMatrixWhenTravelModeTransitAndArrivalTimeTest()
Assert.IsNotNull(response);
Assert.AreEqual(Status.Ok, response.Status);
}

[Test]
public async Task DistanceMatrixWhenTravelModeWalking()
{
var origin = new Address("285 Bedford Ave, Brooklyn, NY, USA");
var destination = new Address("185 Broadway Ave, Manhattan, NY, USA");
var drivingRequest = new DistanceMatrixRequest
{
Key = this.Settings.ApiKey,
Origins = new[]
{
new LocationEx(origin)
},
Destinations = new[]
{
new LocationEx(destination)
},
TravelMode = TravelMode.DRIVING,
};
var drivingResponse = await GoogleMaps.DistanceMatrix.QueryAsync(drivingRequest);

var walkingRequest = new DistanceMatrixRequest
{
Key = this.Settings.ApiKey,
Origins = new[]
{
new LocationEx(origin)
},
Destinations = new[]
{
new LocationEx(destination)
},
TravelMode = TravelMode.WALKING,
};
var walkingResponse = await GoogleMaps.DistanceMatrix.QueryAsync(walkingRequest);

Assert.AreNotEqual(walkingResponse.RawJson, drivingResponse.RawJson, "Walking travel mode response cannot be identical to Driving mode");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public override IList<KeyValuePair<string, string>> GetQueryStringParameters()
parameters.Add("avoid", this.Avoid.ToEnumString('|'));
}

parameters.Add("mode", this.TravelMode.ToString());
parameters.Add("mode", this.TravelMode.ToString().ToLower());

switch (this.TravelMode)
{
Expand Down

0 comments on commit b34092f

Please sign in to comment.