Esempio n. 1
0
        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);
            var response = CreateService().GetResponse(request);


            if (response.Status == ServiceResponseStatus.OverQueryLimit)
            {
                Assert.Ignore("OverQueryLimit");
            }

            // 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));
        }
		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. 3
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));
		}