public void GetChallengerLeague_Test() { var league = api.GetChallengerLeague(Region.euw, Queue.RankedSolo5x5); Assert.IsNotNull(league.Entries); Assert.IsTrue(league.Entries.Count > 0); }
/// <summary> /// Begin producing players. /// </summary> public void Begin() { // Get players var playersAllChallenger = StaticDataStore.Realms.Keys.SelectMany(region => { int retries = 3; while (retries > 0) { try { return(api.GetChallengerLeague(region, querySettings.Queue).Entries.Select(entry => new PlayerEntry(entry, region))); } catch (RiotSharpException ex) { --retries; // Rethrow if we can't retry this exception if (!ex.IsRetryable()) { throw; } } } throw new RiotSharpException(string.Format("Error downloading matches for region {0}", region.ToString())); }); var playersAllMaster = StaticDataStore.Realms.Keys.SelectMany(region => { int retries = 3; while (retries > 0) { try { return(api.GetMasterLeague(region, querySettings.Queue).Entries.Select(entry => new PlayerEntry(entry, region))); } catch (RiotSharpException ex) { --retries; // Rethrow if we can't retry this exception if (!ex.IsRetryable()) { throw; } } } throw new RiotSharpException(string.Format("Error downloading matches for region {0}", region.ToString())); }); var playersAllPro = playersAllChallenger.Concat(playersAllMaster); // Post players playersAllPro.AsParallel().WithDegreeOfParallelism(4).ForAll(player => { PlayerBufferBlock.Post(player); }); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Finished queueing players to process"); Console.ResetColor(); PlayerBufferBlock.Complete(); }