public IEnumerable <PastMatch> GetMatchesForTournament(long tournamentID) { var jsonMatches = accessor.GetMatchesForTournament(tournamentID, 50); List <PastMatch> matches = new List <PastMatch>(); var tournament = tournaments.Where(t => t.ID == tournamentID).First(); if (tournament == null) { return(null); } foreach (var match in jsonMatches) { //TODO: Hopefully these teams will also be stored in cache so don't need to call API so many times since teams don't change by the minute. Look into it var jsonRadiant = accessor.GetTeamInfo(match.RadiantTeamID); var jsonDire = accessor.GetTeamInfo(match.DireTeamID); matches.Add(new PastMatch { ID = match.ID, StartTime = match.StartTime, Tournament = new Tournament { ID = tournament.ID, Name = tournament.Name, TicketItemID = tournament.TicketItemID, }, Radiant = convertJsonTeamToTeam(null, jsonRadiant, null, null), Dire = convertJsonTeamToTeam(null, jsonDire, null, null), }); } return(matches); }
public void GetMatchIDsForTournament(long tournamentID, int numMatches) { var matches = accessor.GetMatchesForTournament(tournamentID, numMatches); Assert.AreEqual(numMatches, matches.Count()); }