Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
        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");
        }
Exemplo n.º 4
0
        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");
        }
Exemplo n.º 5
0
        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");
        }
Exemplo n.º 6
0
        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");
        }
Exemplo n.º 7
0
        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");
        }
Exemplo n.º 8
0
        public void VerifyAutocompleteNoTestAsync()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.ThrowsAsync <ArgumentNullException>(async() => await gis.autocompleteAsync(null), "Search text cannot be blank");
        }