コード例 #1
0
 public void EmptyPathShouldThrow()
 {
     Assert.Throws <InvalidOperationException>(() =>
     {
         var request = new SnapToRoadsRequest {
             Path = Array.Empty <LatLng>()
         };
         CreateService().GetResponse(request);
     });
 }
コード例 #2
0
        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");
        }
コード例 #3
0
        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");
        }
コード例 #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);
        }
コード例 #5
0
        public async Task <SnapToRoadsResponse> GetResponseAsync(SnapToRoadsRequest request)
        {
            var url = new Uri(baseUri, request.ToUri());

            return(await http.GetAsync <SnapToRoadsResponse>(url));
        }
コード例 #6
0
        public SnapToRoadsResponse GetResponse(SnapToRoadsRequest request)
        {
            var url = new Uri(baseUri, request.ToUri());

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