public TimeLine BuildTimeLine(GameId gameId, string hashTag) { var footballGame = GetFootballGame(gameId); var tweets = GetTweets(gameId, hashTag, footballGame); return(new TimeLine(footballGame, tweets)); }
public FootballGame(GameId gameId) { HomeTeam = gameId.HomeTeam; AwayTeam = gameId.AwayTeam; League = gameId.League; Events = new List <MatchEvent>(); Tweets = new List <Tweet>(); }
public FootballGame Create(GameId gameId) { var events = _eventCollector.CollectEvent(gameId); FootballGame game = new FootballGame(gameId); events.ForEach(game.AddEvent); _gameRepository.Save(game); return(game); }
private FootballGame GetFootballGame(GameId gameId) { FootballGame footballGame = _gameRepository.Find(gameId); if (footballGame == FootballGame.Null) { footballGame = Create(gameId); } return(footballGame); }
private List <Tweet> GetTweets(GameId gameId, string hashTag, FootballGame footballGame) { if (_tweetRepository.IsTweetOfGameCollected(gameId)) { return(_tweetRepository.GetGameTweets(gameId)); } var tweets = _tweetConnector.CollectTweets(footballGame, hashTag).ToList(); tweets.ForEach(t => _tweetRepository.AddEvent(gameId, t)); return(tweets); }