public void InsightsConstruction() { var city = new City(); var insightsReponse = new InsightsResponse(city); Assert.AreEqual(insightsReponse.City, city); }
public void CanDeserializeInsightsResponse(InsightsResponse insights) { insights.SetLocales(new List<string> { "en" }); Assert.AreEqual(76, insights.City.Confidence); Assert.AreEqual(9876, insights.City.GeoNameId); Assert.AreEqual("Minneapolis", insights.City.Name); Assert.AreEqual("NA", insights.Continent.Code); Assert.AreEqual(42, insights.Continent.GeoNameId); Assert.AreEqual("North America", insights.Continent.Name); Assert.AreEqual(99, insights.Country.Confidence); Assert.AreEqual(1, insights.Country.GeoNameId); Assert.AreEqual("US", insights.Country.IsoCode); Assert.AreEqual("United States of America", insights.Country.Name); Assert.AreEqual(1500, insights.Location.AccuracyRadius); Assert.AreEqual(44.979999999999997, insights.Location.Latitude); Assert.AreEqual(93.263599999999997, insights.Location.Longitude); Assert.AreEqual(765, insights.Location.MetroCode); Assert.AreEqual("America/Chicago", insights.Location.TimeZone); Assert.AreEqual(50000, insights.Location.AverageIncome); Assert.AreEqual(100, insights.Location.PopulationDensity); Assert.AreEqual(11, insights.MaxMind.QueriesRemaining); Assert.AreEqual("55401", insights.Postal.Code); Assert.AreEqual(33, insights.Postal.Confidence); Assert.AreEqual(2, insights.RegisteredCountry.GeoNameId); Assert.AreEqual("CA", insights.RegisteredCountry.IsoCode); Assert.AreEqual("Canada", insights.RegisteredCountry.Name); Assert.AreEqual(3, insights.RepresentedCountry.GeoNameId); Assert.AreEqual("GB", insights.RepresentedCountry.IsoCode); Assert.AreEqual("United Kingdom", insights.RepresentedCountry.Name); Assert.AreEqual("military", insights.RepresentedCountry.Type); Assert.AreEqual(2, insights.Subdivisions.Count); insights.Subdivisions[0].Locales = new List<string> { "en" }; Assert.AreEqual(88, insights.Subdivisions[0].Confidence); Assert.AreEqual(574635, insights.Subdivisions[0].GeoNameId); Assert.AreEqual("MN", insights.Subdivisions[0].IsoCode); Assert.AreEqual("Minnesota", insights.Subdivisions[0].Name); Assert.AreEqual("TT", insights.Subdivisions[1].IsoCode); Assert.AreEqual(1234, insights.Traits.AutonomousSystemNumber); Assert.AreEqual("AS Organization", insights.Traits.AutonomousSystemOrganization); Assert.AreEqual("example.com", insights.Traits.Domain); Assert.AreEqual("1.2.3.4", insights.Traits.IPAddress); #pragma warning disable 0618 Assert.AreEqual(true, insights.Traits.IsAnonymousProxy); Assert.AreEqual(true, insights.Traits.IsSatelliteProvider); #pragma warning restore 0618 Assert.AreEqual("Comcast", insights.Traits.Isp); Assert.AreEqual("Blorg", insights.Traits.Organization); Assert.AreEqual("college", insights.Traits.UserType); }