Пример #1
0
        public TimeLine BuildTimeLine(GameId gameId, string hashTag)
        {
            var footballGame = GetFootballGame(gameId);
            var tweets       = GetTweets(gameId, hashTag, footballGame);

            return(new TimeLine(footballGame, tweets));
        }
Пример #2
0
 public FootballGame(GameId gameId)
 {
     HomeTeam = gameId.HomeTeam;
     AwayTeam = gameId.AwayTeam;
     League   = gameId.League;
     Events   = new List <MatchEvent>();
     Tweets   = new List <Tweet>();
 }
Пример #3
0
        public FootballGame Create(GameId gameId)
        {
            var          events = _eventCollector.CollectEvent(gameId);
            FootballGame game   = new FootballGame(gameId);

            events.ForEach(game.AddEvent);
            _gameRepository.Save(game);
            return(game);
        }
Пример #4
0
        private FootballGame GetFootballGame(GameId gameId)
        {
            FootballGame footballGame = _gameRepository.Find(gameId);

            if (footballGame == FootballGame.Null)
            {
                footballGame = Create(gameId);
            }
            return(footballGame);
        }
Пример #5
0
        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);
        }