Exemple #1
0
 public void EmptyPathShouldThrow()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         var request = new SnapToRoadsRequest {
             Path = Array.Empty <LatLng>()
         };
         CreateService().GetResponse(request);
     });
 }
        public void RequestGeneratesCorrectUri()
        {
            var req = new SnapToRoadsRequest
            {
                Path = new[] { new LatLng(1.0, 1.0), new LatLng(2.0, 2.0) }
            };

            var uri = req.ToUri();

            Assert.AreEqual(uri.ToString(), "snapToRoads?path=1.000000,1.000000|2.000000,2.000000&interpolate=false");
        }
        public void RequestGeneratesUriWithInterpolation()
        {
            var req = new SnapToRoadsRequest
            {
                Path        = new[] { new LatLng(1.0, 2.0), new LatLng(3.0, 4.0) },
                Interpolate = true
            };

            var uri = req.ToUri();

            Assert.AreEqual(uri.ToString(), "snapToRoads?path=1.000000,2.000000|3.000000,4.000000&interpolate=true");
        }
Exemple #4
0
        public void SnapToRoadWithoutInterpolationShouldReturnTheSameAmountOfPoints()
        {
            var req = new SnapToRoadsRequest
            {
                Path = new[]
                {
                    new LatLng(54.327387, 18.752565),
                    new LatLng(54.327731, 18.755843),
                    new LatLng(54.327753, 18.759932),
                    new LatLng(54.328535, 18.766938)
                },
                Interpolate = false
            };

            var response = CreateService().GetResponse(req);

            Assert.AreEqual(4, response.SnappedPoints.Length);
        }
        public async Task <SnapToRoadsResponse> GetResponseAsync(SnapToRoadsRequest request)
        {
            var url = new Uri(baseUri, request.ToUri());

            return(await http.GetAsync <SnapToRoadsResponse>(url));
        }
        public SnapToRoadsResponse GetResponse(SnapToRoadsRequest request)
        {
            var url = new Uri(baseUri, request.ToUri());

            return(http.Get <SnapToRoadsResponse>(url));
        }