public void GetElevationForTwoLocations()
		{
			// expectations
			var expectedStatus = ServiceResponseStatus.Ok;
			var expectedResultCount = 2;

			var expectedElevation1 = 1608.6m;
			var expectedLocation1 = new LatLng(39.739153,-104.984703);
			var expectedElevation2 = -50.789m;
			var expectedLocation2 = new LatLng(36.4555560,-116.8666670);

			// test
			var request = new ElevationRequest();

			request.AddLocations(expectedLocation1, expectedLocation2);
			request.Sensor = false;
			var response = new ElevationService().GetResponse(request);

			// asserts
			Assert.AreEqual(expectedStatus, response.Status);

			Assert.AreEqual(expectedResultCount, response.Results.Length);
			
			Assert.That(expectedElevation1, Is.EqualTo(response.Results[0].Elevation).Within(0.1));
			Assert.That(expectedLocation1, Is.EqualTo(response.Results[0].Location));
			
			Assert.That(expectedElevation2, Is.EqualTo(response.Results[1].Elevation).Within(0.1));
			Assert.That(expectedLocation2, Is.EqualTo(response.Results[1].Location));
		}
Esempio n. 2
0
        public void GetElevationForOneLocation()
        {
            // expectations
            var expectedStatus      = ServiceResponseStatus.Ok;
            var expectedResultCount = 1;
            var expectedElevation   = 1608.6m;
            var expectedLocation    = new LatLng(39.739153, -104.984703);

            // test
            var request = new ElevationRequest();

            request.AddLocations(expectedLocation);
            var response = CreateService().GetResponse(request);

            // asserts
            Assert.AreEqual(expectedStatus, response.Status);
            Assert.AreEqual(expectedResultCount, response.Results.Length);

            Assert.That(expectedElevation, Is.EqualTo(response.Results[0].Elevation).Within(0.1));

            Assert.That(expectedLocation, Is.EqualTo(response.Results[0].Location));
        }
		public void GetElevationForOneLocation()
		{
			// expectations
			var expectedStatus = ServiceResponseStatus.Ok;
			var expectedResultCount = 1;
			var expectedElevation = 1608.6m;
			var expectedLocation = new LatLng(39.739153, -104.984703);
			
			// test
			var request = new ElevationRequest();

			request.AddLocations(expectedLocation);
			request.Sensor = false;
			var response = new ElevationService().GetResponse(request);

			// asserts
			Assert.AreEqual(expectedStatus, response.Status);
			Assert.AreEqual(expectedResultCount, response.Results.Length);

			Assert.That(expectedElevation, Is.EqualTo(response.Results[0].Elevation).Within(0.1));
			
			Assert.That(expectedLocation, Is.EqualTo(response.Results[0].Location));
		}
Esempio n. 4
0
        /// <summary>
        /// Sends the specified request to the Google Maps Elevation web
        /// service and parses the response as an ElevationResponse
        /// object.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ElevationResponse GetResponse(ElevationRequest request)
        {
            var url = new Uri(this.BaseUri, request.ToUri());

            return(Internal.Http.Get(url).As <ElevationResponse>());
        }
Esempio n. 5
0
        public async Task <ElevationResponse> GetResponseAsync(ElevationRequest request)
        {
            var url = new Uri(baseUri, request.ToUri());

            return(await http.GetAsync <ElevationResponse>(url));
        }
Esempio n. 6
0
        /// <summary>
        ///     Sends the specified request to the Google Maps Elevation web
        ///     service and parses the response as an ElevationResponse
        ///     object.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ElevationResponse GetResponse(ElevationRequest request)
        {
            var url = new Uri(baseUri, request.ToUri());

            return(http.Get <ElevationResponse>(url));
        }
		/// <summary>
		/// Sends the specified request to the Google Maps Elevation web
		/// service and parses the response as an ElevationResponse
		/// object.
		/// </summary>
		/// <param name="request"></param>
		/// <returns></returns>
		public ElevationResponse GetResponse(ElevationRequest request)
		{
			var url = new Uri(this.BaseUri, request.ToUri());
			return Internal.Http.Get(url).As<ElevationResponse>();
		}