Directions Request.
Inheritance: GoogleApi.Entities.Maps.Common.BaseMapsRequest, IQueryStringRequest
Exemple #1
0
        public void DirectionsSumOfStepDistancesCorrectTest()
        {
            var _request = new DirectionsRequest { Origin = "285 Bedford Ave, Brooklyn, NY, USA", Destination = "185 Broadway Ave, Manhattan, NY, USA" };

            var _result = GoogleMaps.Directions.Query(_request);

            if (_result.Status == Status.OVER_QUERY_LIMIT)
                Assert.Inconclusive("Cannot run test since you have exceeded your Google API query limit.");

            Assert.AreEqual(Status.OK, _result.Status);
            Assert.AreEqual(5284, _result.Routes.First().Legs.First().Steps.Sum(_s => _s.Distance.Value));
        }
Exemple #2
0
        public void DirectionsAsyncSumOfStepDistancesCorrectTest()
        {
            var _request = new DirectionsRequest { Origin = "55.866413, 12.501063", Destination = "55.781495, 12.50114", DepartureTime = DateTime.UtcNow, TravelMode = TravelMode.Driving };

            var _result = GoogleMaps.Directions.QueryAsync(_request).Result;

            if (_result.Status == Status.OVER_QUERY_LIMIT)
                Assert.Inconclusive("Cannot run test since you have exceeded your Google API query limit.");

            Assert.AreEqual(Status.OK, _result.Status);
            Assert.AreEqual(5284, _result.Routes.First().Legs.First().Steps.Sum(_s => _s.Distance.Value));
        }
Exemple #3
0
        public void DirectionsWhenhWayPointsTest()
        {
            var request = new DirectionsRequest { Origin = "NYC, USA", Destination = "Miami, USA", Waypoints = new[] { "Philadelphia, USA" }, OptimizeWaypoints = true };

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

            if (result.Status == Status.OverQueryLimit)
                Assert.Inconclusive("Cannot run test since you have exceeded your Google API query limit.");

            Assert.AreEqual(Status.Ok, result.Status);
            Assert.AreEqual(156084, result.Routes.First().Legs.First().Steps.Sum(s => s.Distance.Value), 15000);

            StringAssert.Contains("Philadelphia", result.Routes.First().Legs.First().EndAddress);
        }
Exemple #4
0
        public void DirectionsTestTest()
        {
            var request = new DirectionsRequest { Origin = "285 Bedford Ave, Brooklyn, NY, USA", Destination = "185 Broadway Ave, Manhattan, NY, USA" };

            var result = GoogleMaps.Directions.Query(request);
            var overviewPath = result.Routes.First().OverviewPath;
            var polyline = result.Routes.First().Legs.First().Steps.First().PolyLine;

            if (result.Status == Status.OverQueryLimit)
                Assert.Inconclusive("Cannot run test since you have exceeded your Google API query limit.");

            Assert.AreEqual(Status.Ok, result.Status);
            Assert.AreEqual(133, overviewPath.Points.Count(), 5);
            Assert.AreEqual(5, polyline.Points.Count());
            Assert.AreEqual(8253, result.Routes.First().Legs.First().Steps.Sum(s => s.Distance.Value), 300);
            Assert.AreEqual(355, result.Routes.First().Legs.First().Steps.Sum(s => s.Duration.Value.Seconds), 50);
        }
Exemple #5
0
        public void DirectionsTestTest()
        {
            var _request = new DirectionsRequest { Origin = "285 Bedford Ave, Brooklyn, NY, USA", Destination = "185 Broadway Ave, Manhattan, NY, USA" };

            var _result = GoogleMaps.Directions.Query(_request);
            var _overviewPath = _result.Routes.First().OverviewPath;
            var _polyline = _result.Routes.First().Legs.First().Steps.First().PolyLine;

            if (_result.Status == Status.OVER_QUERY_LIMIT)
                Assert.Inconclusive("Cannot run test since you have exceeded your Google API query limit.");

            Assert.AreEqual(Status.OK, _result.Status);
            Assert.AreEqual(155, _overviewPath.Points.Count());
            Assert.AreEqual(4, _polyline.Points.Count());
            Assert.AreEqual(11777, _result.Routes.First().Legs.First().Steps.Sum(_s => _s.Distance.Value));
            Assert.AreEqual(469, _result.Routes.First().Legs.First().Steps.Sum(_s => _s.Duration.Value.Seconds));
        }
Exemple #6
0
        public void DirectionsCorrectOverviewPathTest()
        {
            var _request = new DirectionsRequest
                {
                    Destination = "maleva 10, Ahtme, Kohtla-Järve, 31025 Ida-Viru County, Estonia",
                    Origin = "veski 2, Jõhvi Parish, 41532 Ida-Viru County, Estonia"
                };

            var _result = GoogleMaps.Directions.Query(_request);

            var _overviewPath = _result.Routes.First().OverviewPath;

            var _polyline = _result.Routes.First().Legs.First().Steps.First().PolyLine;

            Assert.AreEqual(Status.OK, _result.Status);
            Assert.AreEqual(120, _overviewPath.Points.Count());
            Assert.AreEqual(2, _polyline.Points.Count());
        }
Exemple #7
0
        public void DirectionsWithWayPointsTest()
        {
            var _request = new DirectionsRequest { Origin = "NYC, USA", Destination = "Miami, USA", Waypoints = new[]{"Philadelphia, USA"}, OptimizeWaypoints = true};

            var _result = GoogleMaps.Directions.Query(_request);

            if (_result.Status == Status.OVER_QUERY_LIMIT)
                Assert.Inconclusive("Cannot run test since you have exceeded your Google API query limit.");

            Assert.AreEqual(Status.OK, _result.Status);
            Assert.AreEqual(152601, _result.Routes.First().Legs.First().Steps.Sum(_s => _s.Distance.Value));

            StringAssert.Contains("Philadelphia", _result.Routes.First().Legs.First().EndAddress);
        }