コード例 #1
0
        /// <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());
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        public void VerifyAddressParserNoAddress()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.Throws <ArgumentNullException>(() => gis.parseAddress(null), "Address is a required parameter");
        }