コード例 #1
0
        public void GetIPGeolocationTest()
        {
            var helper = new GeolocationHelper("db");
            var info   = helper.GetIPGeolocation("62.213.10.13");

            Assert.AreEqual("Nizhny Novgorod", info.City);
            Assert.AreEqual("062.213.011.127", info.IPEnd);
            Assert.AreEqual("062.213.008.240", info.IPStart);
            Assert.AreEqual("RU", info.Key);
            Assert.AreEqual("Europe/Moscow", info.TimezoneName);
            Assert.AreEqual(4d, info.TimezoneOffset);

            info = helper.GetIPGeolocation("");
            Assert.AreEqual(IPGeolocationInfo.Default.City, info.City);
            Assert.AreEqual(IPGeolocationInfo.Default.IPEnd, info.IPEnd);
            Assert.AreEqual(IPGeolocationInfo.Default.IPStart, info.IPStart);
            Assert.AreEqual(IPGeolocationInfo.Default.Key, info.Key);
            Assert.AreEqual(IPGeolocationInfo.Default.TimezoneName, info.TimezoneName);
            Assert.AreEqual(IPGeolocationInfo.Default.TimezoneOffset, info.TimezoneOffset);
        }
コード例 #2
0
        public object GetIPInformation(string ipAddress)
        {
            GeolocationHelper helper = new GeolocationHelper("teamlabsite");

            return(helper.GetIPGeolocation(ipAddress));
        }