public async Task VerifyGeocodeAddressCountryAndPostalAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); WaitForApiLimit(); //Check Albany International Airport var result = await gis.geocodeAsync(ALBANY_AIRPORT_ADDRESS, "US", "12205"); 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(167344877, firstResult.id); Assert.AreEqual(-73.80948451774645, firstResult.longitude); Assert.AreEqual(42.74511469046002, firstResult.latitude); Assert.AreEqual("Airport Terminal Road", firstResult.name); Assert.AreEqual("Airport Terminal Road", firstResult.streetName); Assert.AreEqual("UNCLASSIFIED", firstResult.streetType); Assert.AreEqual("12205", firstResult.zipCode); Assert.AreEqual("Shakers", firstResult.dependentLocality); Assert.AreEqual("Colonie", firstResult.city); Assert.AreEqual("Albany County", firstResult.state); Assert.AreEqual("US", firstResult.countryCode); Assert.AreEqual("STREET", firstResult.geocodingLevel); Console.WriteLine(result.ToString()); }
public void VerifyGeocodeIncorrectCountryCodeFormatAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.geocodeAsync(ALBANY_AIRPORT_ADDRESS, "United States"), "Country needs to be the ISO 3166 Alpha 2 code"); }
public void VerifyGeocodeNoAddressAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentNullException>(async() => await gis.geocodeAsync(null), "Address is a required parameter"); }