public JsonResult Get(DateTime sinceDateTime) { var tweets = _getPBPTweetsService.GeTweetsSince(sinceDateTime).ToList(); var response = new GetPBPTweetsResponseModel { tweets = tweets.OrderByDescending(tweet => tweet.TweetedAt) .Select(tweet => new GetPBPTweetsResponseModel.Tweet { text = tweet.Text, tweetedAt = tweet.TweetedAt.ToString("G"), user = tweet.User }) .ToArray(), userAggregateData = TweetAggregator.Process(tweets) .ToDictionary(pair => pair.Key, pair => new GetPBPTweetsResponseModel.UserAggregateData { mentions = pair.Value.Mentions, totalTweets = pair.Value.TotalTweets }) }; return Json(response, JsonRequestBehavior.AllowGet); }
public void WhenARequestIsReceivedToSeeAllTweetsSince2WeeksBefore(DateTime sinceDateTime) { _response = _controller.Get(sinceDateTime.AddDays(-14)).Data as GetPBPTweetsResponseModel; }