protected string GetLocationInfo(OnlineUserInfo oui) { string result = string.Empty; try { string countryName = GeoCountryLookup.LookupCountryName(oui.IPAddress); result = Server.HtmlEncode(countryName); } catch (Exception exc) { Debug.WriteLine(exc.ToString()); } return(result); }
public void CanLookup() { using (var geoCountryLookup = new GeoCountryLookup()) { if (_addresses?.Any() ?? false) { foreach (var kvp in _addresses) { var ip = kvp.Key; var expect = kvp.Value; var response = geoCountryLookup.LookupCountry(ip); Assert.AreEqual(expect.IsoCode, response.IsoCode, response.Name); Assert.AreEqual(expect.Name, response.Name, response.Name); Assert.AreEqual(expect.IsInEu, response.IsInEu, response.Name); } } } }