コード例 #1
0
        public void VerifyAutcompleteTextOnly()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            WaitForApiLimit();

            var result      = gis.autocomplete(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());
        }
コード例 #2
0
        public void VerifyAutocompleteInvalidCountry()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.Throws <ArgumentOutOfRangeException>(() => gis.autocomplete(ALBANY_AUTOCOMPLETE, false, null, 0, 0, 1000, false, Gisgraphy.Styles.MEDIUM, "United States"), "Country needs to be the ISO 3166 Alpha 2 code");
        }
コード例 #3
0
        public void VerifyAutocompleteInvalidLang()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.Throws <ArgumentOutOfRangeException>(() => gis.autocomplete(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");
        }
コード例 #4
0
        public void VerifyAutocompleteInvalidRadius()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.Throws <ArgumentOutOfRangeException>(() => gis.autocomplete(ALBANY_AUTOCOMPLETE, false, null, 0, 0, -100), "Radius must be greater than 0");
        }
コード例 #5
0
        public void VerifyAutocompleteLngNoLat()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.Throws <ArgumentNullException>(() => gis.autocomplete(ALBANY_AUTOCOMPLETE, false, null, null, 0), "If using latitude and longitude, both values must be provided");
        }
コード例 #6
0
        public void VerifyAutocompleteInvalidLngLow()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.Throws <ArgumentOutOfRangeException>(() => gis.autocomplete(ALBANY_AUTOCOMPLETE, false, null, 0, -200), "Longitude must be between -180 and 180");
        }
コード例 #7
0
        public void VerifyAutocompleteInvalidLatHigh()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.Throws <ArgumentOutOfRangeException>(() => gis.autocomplete(ALBANY_AUTOCOMPLETE, false, null, 100, 0), "Latitude must be between -90 an 90");
        }
コード例 #8
0
        public void VerifyAutocompleteNoTest()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.Throws <ArgumentNullException>(() => gis.autocomplete(null), "Search text cannot be blank");
        }