public void ProcessResults_Parses_Location() { var trendProc = new TrendRequestProcessor <Trend> { Type = TrendType.Place }; List <Trend> trendList = trendProc.ProcessResults(TestTrendQueryResponse); Assert.NotNull(trendList); var trends = trendList.FirstOrDefault(); Assert.NotNull(trends); var locations = trends.Locations; Assert.NotNull(locations); Assert.Equal(1, locations.Count); Location location = locations[0]; Assert.Equal("Worldwide", location.Name); Assert.Equal(1, location.WoeID); Assert.Equal("%22Julianna%20Margulies%22", trends.Query); Assert.Equal("Julianna Margulies", trends.Name); Assert.Null(trends.PromotedContent); Assert.Equal("http://twitter.com/search/%22Julianna%20Margulies%22", trends.SearchUrl); Assert.Null(trends.Events); Assert.Equal(new DateTime(2011, 9, 19, 2, 4, 39), trends.AsOf); Assert.Equal(new DateTime(2011, 9, 19, 2, 0, 17), trends.CreatedAt); }
public void ProcessResults_Handles_Available() { var trendReqProc = new TrendRequestProcessor <Trend> { Type = TrendType.Available }; List <Trend> trendList = trendReqProc.ProcessResults(TestAvailableOrClosestQueryResponse); Assert.NotNull(trendList); var trends = trendList.SingleOrDefault(); Assert.NotNull(trends); var locations = trends.Locations; Assert.NotNull(locations); Assert.Equal(2, locations.Count); Location location = locations[0]; Assert.Equal("Country", location.PlaceTypeName); Assert.Equal(12, location.PlaceTypeNameCode); Assert.Equal("Turkey", location.Name); Assert.Equal("http://where.yahooapis.com/v1/place/23424969", location.Url); Assert.Equal(23424969, location.WoeID); Assert.Equal("TR", location.CountryCode); Assert.Equal("1", location.ParentID); Assert.Equal("Turkey", location.Country); }
public void ProcessResults_Handles_Closest() { var trendReqProc = new TrendRequestProcessor <Trend> { Type = TrendType.Closest }; List <Trend> trendList = trendReqProc.ProcessResults(TestAvailableOrClosestQueryResponse); Assert.NotNull(trendList); var trends = trendList.SingleOrDefault(); Assert.NotNull(trends); var locations = trends.Locations; Assert.NotNull(locations); Assert.Equal(2, locations.Count); Location location = locations[1]; Assert.NotNull(location); Assert.Equal("Town", location.PlaceTypeName); Assert.Equal(7, location.PlaceTypeNameCode); Assert.Equal("Birmingham", location.Name); Assert.Equal("http://where.yahooapis.com/v1/place/2364559", location.Url); Assert.Equal(2364559, location.WoeID); Assert.Equal("US", location.CountryCode); Assert.Equal("23424977", location.ParentID); Assert.Equal("United States", location.Country); }
public void ProcessResults_Returns_Empty_Collection_When_Empty_Results() { var trendProc = new TrendRequestProcessor <Trend>(); var trends = trendProc.ProcessResults(string.Empty); Assert.Equal(0, trends.Count); }
public void ProcessAvailableTrendResultsTest() { TrendRequestProcessor <Trend> target = new TrendRequestProcessor <Trend>(); XElement twitterResponse = XElement.Parse(m_testAvailableQueryResponse); IList actual = target.ProcessResults(twitterResponse); var trends = actual.Cast <Trend>().ToList(); Assert.AreEqual(10, trends[0].Locations.Count); }
public void ProcessCurrentTrendResultsTest() { TrendRequestProcessor <Trend> target = new TrendRequestProcessor <Trend>(); XElement twitterResponse = XElement.Parse(m_testCurrentTrendQueryResponse); IList actual = target.ProcessResults(twitterResponse); var trends = actual.Cast <Trend>().ToList(); Assert.AreEqual(10, trends.Count); Assert.AreNotEqual(DateTime.MinValue.Date, trends[0].AsOf.Date); }
public void ProcessResults_Populates_Input_Parameters() { var trendProc = new TrendRequestProcessor<Trend>() { BaseUrl = "https://api.twitter.com/1.1/", Type = TrendType.Place, Exclude = true, Latitude = "1.1", Longitude = "2.2", WoeID = 1 }; var trends = trendProc.ProcessResults(TestTrendQueryResponse); Assert.NotNull(trends); Assert.NotEmpty(trends); var trend = trends.First(); Assert.NotNull(trend); Assert.True(trend.Exclude); Assert.Equal("1.1", trend.Latitude); Assert.Equal("2.2", trend.Longitude); Assert.Equal(1, trend.WoeID); }
public void ProcessResults_Populates_Input_Parameters() { var trendProc = new TrendRequestProcessor<Trend>() { BaseUrl = "https://api.twitter.com/1.1/", Type = TrendType.Place, Exclude = true, Latitude = 1.1, Longitude = 2.2, WoeID = 1 }; List<Trend> trends = trendProc.ProcessResults(TestTrendQueryResponse); Assert.IsNotNull(trends); Assert.IsTrue(trends.Any()); Trend trend = trends.First(); Assert.IsNotNull(trend); Assert.IsTrue(trend.Exclude); Assert.AreEqual(1.1, trend.Latitude); Assert.AreEqual(2.2, trend.Longitude); Assert.AreEqual(1, trend.WoeID); }
public void ProcessResults_Populates_Input_Parameters() { var trendProc = new TrendRequestProcessor <Trend>() { BaseUrl = "https://api.twitter.com/1.1/", Type = TrendType.Place, Exclude = true, Latitude = "1.1", Longitude = "2.2", WoeID = 1 }; var trends = trendProc.ProcessResults(TestTrendQueryResponse); Assert.NotNull(trends); Assert.NotEmpty(trends); var trend = trends.First(); Assert.NotNull(trend); Assert.True(trend.Exclude); Assert.Equal("1.1", trend.Latitude); Assert.Equal("2.2", trend.Longitude); Assert.Equal(1, trend.WoeID); }
public void ProcessResults_Populates_Input_Parameters() { var trendProc = new TrendRequestProcessor <Trend>() { BaseUrl = "https://api.twitter.com/1.1/", Type = TrendType.Place, Exclude = true, Latitude = 1.1, Longitude = 2.2, WoeID = 1 }; List <Trend> trends = trendProc.ProcessResults(TestTrendQueryResponse); Assert.IsNotNull(trends); Assert.IsTrue(trends.Any()); Trend trend = trends.First(); Assert.IsNotNull(trend); Assert.IsTrue(trend.Exclude); Assert.AreEqual(1.1, trend.Latitude); Assert.AreEqual(2.2, trend.Longitude); Assert.AreEqual(1, trend.WoeID); }
public void ProcessResults_Returns_Empty_Collection_When_Empty_Results() { var trendProc = new TrendRequestProcessor<Trend>(); var trends = trendProc.ProcessResults(string.Empty); Assert.Equal(0, trends.Count); }
public void ProcessResults_Parses_Location() { var trendProc = new TrendRequestProcessor<Trend> { Type = TrendType.Place }; List<Trend> trendList = trendProc.ProcessResults(TestTrendQueryResponse); Assert.NotNull(trendList); var trends = trendList.FirstOrDefault(); Assert.NotNull(trends); var locations = trends.Locations; Assert.NotNull(locations); Assert.Equal(1, locations.Count); Location location = locations[0]; Assert.Equal("Worldwide", location.Name); Assert.Equal("1", location.WoeID); Assert.Equal("%22Julianna%20Margulies%22", trends.Query); Assert.Equal("Julianna Margulies", trends.Name); Assert.Null(trends.PromotedContent); Assert.Equal("http://twitter.com/search/%22Julianna%20Margulies%22", trends.SearchUrl); Assert.Null(trends.Events); Assert.Equal(new DateTime(2011, 9, 19, 2, 4, 39), trends.AsOf); Assert.Equal(new DateTime(2011, 9, 19, 2, 0, 17), trends.CreatedAt); }
public void ProcessResults_Handles_Closest() { var trendReqProc = new TrendRequestProcessor<Trend> { Type = TrendType.Closest }; List<Trend> trendList = trendReqProc.ProcessResults(TestAvailableOrClosestQueryResponse); Assert.NotNull(trendList); var trends = trendList.SingleOrDefault(); Assert.NotNull(trends); var locations = trends.Locations; Assert.NotNull(locations); Assert.Equal(2, locations.Count); Location location = locations[1]; Assert.NotNull(location); Assert.Equal("Town", location.PlaceTypeName); Assert.Equal(7, location.PlaceTypeNameCode); Assert.Equal("Birmingham", location.Name); Assert.Equal("http://where.yahooapis.com/v1/place/2364559", location.Url); Assert.Equal("2364559", location.WoeID); Assert.Equal("US", location.CountryCode); Assert.Equal("23424977", location.ParentID); Assert.Equal("United States", location.Country); }
public void ProcessResults_Handles_Available() { var trendReqProc = new TrendRequestProcessor<Trend> { Type = TrendType.Available }; List<Trend> trendList = trendReqProc.ProcessResults(TestAvailableOrClosestQueryResponse); Assert.NotNull(trendList); var trends = trendList.SingleOrDefault(); Assert.NotNull(trends); var locations = trends.Locations; Assert.NotNull(locations); Assert.Equal(2, locations.Count); Location location = locations[0]; Assert.Equal("Country", location.PlaceTypeName); Assert.Equal(12, location.PlaceTypeNameCode); Assert.Equal("Turkey", location.Name); Assert.Equal("http://where.yahooapis.com/v1/place/23424969", location.Url); Assert.Equal("23424969", location.WoeID); Assert.Equal("TR", location.CountryCode); Assert.Equal("1", location.ParentID); Assert.Equal("Turkey", location.Country); }
public void ProcessTrendResultsTest() { TrendRequestProcessor<Trend> target = new TrendRequestProcessor<Trend>(); XElement twitterResponse = XElement.Parse(m_testTrendQueryResponse); IList actual = target.ProcessResults(twitterResponse); var trends = actual.Cast<Trend>().ToList(); Assert.AreEqual(10, trends.Count); Assert.AreNotEqual(DateTime.MinValue.Date, trends[0].AsOf.Date); }
public void ProcessAvailableTrendResultsTest() { TrendRequestProcessor<Trend> target = new TrendRequestProcessor<Trend>(); XElement twitterResponse = XElement.Parse(m_testAvailableQueryResponse); IList actual = target.ProcessResults(twitterResponse); var trends = actual.Cast<Trend>().ToList(); Assert.AreEqual(10, trends[0].Locations.Count); }