public async Task VerifyReverseGeocodeAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); WaitForApiLimit(); //Check Albany International Airport var result = await gis.reverseGeocodeAsync(ALBANY_AIRPORT_LAT, ALBANY_AIRPORT_LNG); var firstResult = result.results.FirstOrDefault(); lastApiCall = DateTime.Now; Assert.Greater(result.resultsFound, 0); Assert.AreEqual(result.executionTime, result.executionTimeSpan.TotalSeconds); Assert.AreEqual(result.resultsFound, result.results.Count()); Assert.AreEqual(ALBANY_AIRPORT_LAT, firstResult.latitude); Assert.AreEqual(ALBANY_AIRPORT_LNG, firstResult.longitude); Assert.AreEqual("Airport Terminal Road", firstResult.streetName); Assert.AreEqual("Colonie", firstResult.city); Assert.AreEqual("Shakers", firstResult.citySubdivision); Assert.AreEqual("New York", firstResult.state); Assert.AreEqual("US", firstResult.countryCode); Assert.AreEqual("STREET", firstResult.geocodingLevel); Assert.AreEqual(0.21190578937061122, firstResult.distance); Assert.AreEqual("Airport Terminal Road, Shakers, Colonie, New York, United States, US", firstResult.formattedFull); Console.WriteLine(result.ToString()); }
public void VerifyReverseGeocodeInvalidLngLowAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.reverseGeocodeAsync(0, -200), "Longitude must be between -180 and 180"); }
public void VerifyReverseGeocodeInvalidLatLowAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.reverseGeocodeAsync(-100, 0), "Latitude must be between -90 an 90"); }