public void VerifyGeocodeAddressOnly() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); WaitForApiLimit(); //Check Albany International Airport var result = gis.geocode(ALBANY_AIRPORT_ADDRESS); 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 VerifyConstructor() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.AreEqual(SERVER_URL, gis.serverUrl); Assert.AreEqual(API_KEY, gis.apiKey); }
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 async Task VerifyAutcompleteTextOnlyAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); WaitForApiLimit(); var result = await gis.autocompleteAsync(ALBANY_AUTOCOMPLETE); var firstResult = result.response.results.FirstOrDefault(); lastApiCall = DateTime.Now; Assert.Greater(result.response.resultsFound, 0); Assert.AreEqual(result.responseHeader.executionTime, result.responseHeader.executionTimeSpan.TotalSeconds); Assert.AreEqual(0, result.response.start); Assert.AreEqual(result.response.maxScore, firstResult.score); Assert.AreEqual(8494005, firstResult.featureId); Assert.AreEqual("Albany International Airport Fire Department", firstResult.name); Assert.AreEqual(42.74192810058594, firstResult.latitude); Assert.AreEqual(-73.8081283569336, firstResult.longitude); Assert.AreEqual("Pond", firstResult.placeType); Assert.AreEqual("US", firstResult.countryCode); Assert.AreEqual("S", firstResult.featureClass); Assert.AreEqual("BLDG", firstResult.featureCode); Assert.AreEqual("Albany International Airport Fire Department", firstResult.asciiName); Assert.AreEqual(83, firstResult.elevation); Assert.AreEqual(86, firstResult.gtopo30); Assert.AreEqual("America/New_York", firstResult.timezone); Assert.AreEqual(0, firstResult.population); Assert.AreEqual("United States", firstResult.countryName); Assert.AreEqual(55.05506, firstResult.score); Console.WriteLine(result.ToString()); }
public async Task VerifyStreetServiceLatLngOnlyAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); WaitForApiLimit(); var result = await gis.findStreetAsync(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(167344877, firstResult.id); Assert.AreEqual(-73.80948451774645, firstResult.longitude); Assert.AreEqual(42.74511469046002, firstResult.latitude); Assert.AreEqual("Airport Terminal Road", firstResult.name); Assert.AreEqual("UNCLASSIFIED", firstResult.streetType); Assert.AreEqual("US", firstResult.countryCode); Assert.AreEqual(0.217368757236126, firstResult.distance); Assert.AreEqual(5583598, firstResult.openStreetMapId); Assert.AreEqual(false, firstResult.oneWay); Assert.AreEqual(738.207938454055, firstResult.length); Assert.AreEqual("Colonie", firstResult.isIn); Assert.AreEqual("Shakers", firstResult.isInPlace); Assert.AreEqual("Albany County", firstResult.isInAdm); Console.WriteLine(result.ToString()); }
public async Task VerifyGeolocalizationServiceAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); WaitForApiLimit(); var result = await gis.geolocalizationAsync(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(637.999392531314, firstResult.distance); Assert.AreEqual("Shakers", firstResult.name); Assert.AreEqual("NY", firstResult.adm1Code); Assert.AreEqual("001", firstResult.adm2Code); Assert.AreEqual("New York", firstResult.adm1Name); Assert.AreEqual("Albany County", firstResult.adm2Name); Assert.AreEqual("Shakers", firstResult.asciiName); Assert.AreEqual("US", firstResult.countryCode); Assert.AreEqual(83, firstResult.elevation); Assert.AreEqual("P", firstResult.featureClass); Assert.AreEqual("PPL", firstResult.featureCode); Assert.AreEqual(5137753, firstResult.featureId); Assert.AreEqual(85, firstResult.gtopo30); Assert.AreEqual(0, firstResult.population); Assert.AreEqual("America/New_York", firstResult.timezone); Assert.AreEqual(42.73952102661133, firstResult.latitude); Assert.AreEqual(-73.81123352050781, firstResult.longitude); Assert.AreEqual("city", firstResult.placeType); Assert.AreEqual(158912974, firstResult.openStreetMapId); Assert.AreEqual("https://www.google.fr/maps/preview#!q=42.76952102661133+-73.81123352050781", firstResult.googleMapUrl); Assert.AreEqual("http://maps.yahoo.com/place/?lat=42.73952102661133&lon=-73.81123352050781", firstResult.yahooMapUrl); Assert.AreEqual("http://www.openstreetmap.org/#map=14/42.73952102661133/-73.81123352050781", firstResult.openStreetMapUrl); Assert.AreEqual("/images/flags/US.png", firstResult.countryFlagUrl); Assert.AreEqual("hamlet", firstResult.amenity); Console.WriteLine(result.ToString()); }
/// <summary> /// Might enable this, this feature is pretty bad /// </summary> public void VerifyAddressParserAddressOnly() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); WaitForApiLimit(); //Check Albany International Airport var result = gis.parseAddress(ALBANY_AIRPORT_POSTAL_ADDRESS); 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(firstResult.geocodingLevel, "CITY"); Assert.AreEqual(firstResult.city, "Terminal"); Assert.AreEqual(firstResult.countryCode, "US"); Assert.AreEqual(firstResult.confidence, "LOW"); Console.WriteLine(result.ToString()); }
public void VerifyStreetServiceInvalidLatHigh() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.Throws <ArgumentOutOfRangeException>(() => gis.findStreet(100, 0), "Latitude must be between -90 an 90"); }
public void VerifyAutocompleteNoTestAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentNullException>(async() => await gis.autocompleteAsync(null), "Search text cannot be blank"); }
public void VerifyGeolocalizationServiceInvalidRadiusAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.geolocalizationAsync(ALBANY_AIRPORT_LAT, ALBANY_AIRPORT_LNG, -100), "Radius must be greater than 0"); }
public void VerifyStreetServiceInvalidLngLow() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.Throws <ArgumentOutOfRangeException>(() => gis.findStreet(0, -200), "Longitude must be between -180 and 180"); }
public void VerifyAddressParserIncorrectCountryCodeFormat() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.Throws <ArgumentOutOfRangeException>(() => gis.parseAddress(ALBANY_AIRPORT_ADDRESS, "United States"), "Country needs to be the ISO 3166 Alpha 2 code"); }
public void VerifyReverseGeocodeInvalidLngLow() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.Throws <ArgumentOutOfRangeException>(() => gis.reverseGeocode(0, -200), "Longitude must be between -180 and 180"); }
public void VerifyAutocompleteInvalidCountryAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.autocompleteAsync(ALBANY_AUTOCOMPLETE, false, null, 0, 0, 1000, false, Gisgraphy.Styles.MEDIUM, "United States"), "Country needs to be the ISO 3166 Alpha 2 code"); }
public void VerifyStreetServiceInvalidLatLowAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.findStreetAsync(-100, 0), "Latitude must be between -90 an 90"); }
public void VerifyAutocompleteLngNoLatAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentNullException>(async() => await gis.autocompleteAsync(ALBANY_AUTOCOMPLETE, false, null, null, 0), "If using latitude and longitude, both values must be provided"); }
public void VerifyAutocompleteInvalidLatHighAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.autocompleteAsync(ALBANY_AUTOCOMPLETE, false, null, 100, 0), "Latitude must be between -90 an 90"); }
public void VerifyStreetAddressInvalidRadiusAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.findStreetAsync(ALBANY_AIRPORT_LAT, ALBANY_AIRPORT_LNG, -100), "Radius must be greater than 0"); }
public void VerifyStreetServiceInvalidLngHighAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.findStreetAsync(0, 200), "Longitude must be between -180 and 180"); }
public void VerifyNoServerURL() { Gisgraphy gis = new Gisgraphy(); Assert.Throws <ArgumentNullException>(() => gis.geocode(ALBANY_AIRPORT_ADDRESS), "Server URL is not set"); }
public void VerifyAutocompleteInvalidLngLowAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.autocompleteAsync(ALBANY_AUTOCOMPLETE, false, null, 0, -200), "Longitude must be between -180 and 180"); }
public void VerifyGeocalizationServiceInvalidLatLow() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.Throws <ArgumentOutOfRangeException>(() => gis.geolocalization(-100, 0), "Latitude must be between -90 an 90"); }
public void VerifyAutocompleteInvalidRadiusAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.autocompleteAsync(ALBANY_AUTOCOMPLETE, false, null, 0, 0, -100), "Radius must be greater than 0"); }
public void VerifyInvalidServerURL() { Gisgraphy gis = new Gisgraphy("INVALID URL", null); Assert.Throws <InvalidCastException>(() => gis.geocode(ALBANY_AIRPORT_ADDRESS), "Server URL is not a valid URI"); }
public void VerifyAutocompleteInvalidLangAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.autocompleteAsync(ALBANY_AUTOCOMPLETE, false, null, 0, 0, 1000, false, Gisgraphy.Styles.MEDIUM, "US", "English"), "Language needs to be the ISO 639 Alpha 2 or Alpha 3 code"); }
public void VerifyGeolocalizationServiceInvalidLngHigh() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.Throws <ArgumentOutOfRangeException>(() => gis.geolocalization(0, 200), "Longitude must be between -180 and 180"); }
public void VerifyAddressParserNoAddress() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.Throws <ArgumentNullException>(() => gis.parseAddress(null), "Address is a required parameter"); }
public void VerifyGeolocalizationServiceInvalidLatHighAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.geolocalizationAsync(100, 0), "Latitude must be between -90 an 90"); }
public void VerifyGeolocalizationServiceInvalidLngLowAsync() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.geolocalizationAsync(0, -200), "Longitude must be between -180 and 180"); }
public void VerifyReverseGeocodeInvalidLatLow() { Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY); Assert.Throws <ArgumentOutOfRangeException>(() => gis.reverseGeocode(-100, 0), "Latitude must be between -90 an 90"); }