예제 #1
0
        // Karma = 43
        // golf1052 = 26040955
        // Chaox = 7460

        public SummonerTests()
        {
            List <string> summonerNames = new List <string>();

            summonerNames.Add("golf1052");
            List <Summoner> summoners = new List <Summoner>();
            Task            task      = Task.Run(async() => { summoners = await creepScore.RetrieveSummoners(CreepScore.Region.NA, summonerNames); });

            task.Wait();
            golf1052 = summoners[0];
        }
예제 #2
0
        public async void RetrieveCurrentGameTest()
        {
            List <string> summonerNames = new List <string>(new string[] {
                "NightBlue3",
                "imaqtpie",
                "voyboy",
                "scarra"
            });
            List <Summoner> summoners = await creepScore.RetrieveSummoners(CreepScore.Region.NA, summonerNames);

            List <CurrentGameInfoLive> currentGameInfo = new List <CurrentGameInfoLive>();

            foreach (Summoner summoner in summoners)
            {
                CurrentGameInfoLive currentGame = null;
                try
                {
                    currentGame = await summoner.RetrieveCurrentGameInfo();
                }
                catch (CreepScoreException ex)
                {
                    if (ex.StatusCode == 404)
                    {
                    }
                    else
                    {
                        throw;
                    }
                }
                currentGameInfo.Add(currentGame);
            }
            foreach (CurrentGameInfoLive currentGame in currentGameInfo)
            {
                if (currentGame != null)
                {
                    Assert.Equal("NA1", currentGame.platformId);
                    ParticipantLive player = null;
                    foreach (ParticipantLive participant in currentGame.participants)
                    {
                        foreach (Summoner summoner in summoners)
                        {
                            if (summoner.name == participant.summonerName)
                            {
                                player = participant;
                                break;
                            }
                        }
                        if (player != null)
                        {
                            break;
                        }
                    }
                    Assert.NotNull(player);
                }
            }
        }
예제 #3
0
        public async void RetrieveSummonersByNameTest()
        {
            List <string> summonerNames = new List <string>();

            summonerNames.Add("golf1052");
            List <Summoner> summoners = await creepScore.RetrieveSummoners(CreepScore.Region.NA, summonerNames);

            Assert.Equal(26040955, summoners[0].id);
            Assert.Equal("golf1052", summoners[0].name);
            Assert.Equal(558, summoners[0].profileIconId);
            Assert.Equal(30, summoners[0].summonerLevel);

            List <string> summonerNames2 = new List <string>();

            summonerNames2.Add("golf1052");
            summonerNames2.Add("Chaox");
            summonerNames2.Add("Fresh Yolo Swag");
            List <Summoner> summoners2 = await creepScore.RetrieveSummoners(CreepScore.Region.NA, summonerNames2);

            Summoner golf1052      = null;
            Summoner chaox         = null;
            Summoner freshYoloSwag = null;

            foreach (Summoner summoner in summoners2)
            {
                if (summoner.name == "golf1052")
                {
                    golf1052 = summoner;
                }
                else if (summoner.name == "Chaox")
                {
                    chaox = summoner;
                }
                else if (summoner.name == "Fresh Yolo Swag")
                {
                    freshYoloSwag = summoner;
                }
            }

            Assert.Equal(26040955, golf1052.id);
            Assert.Equal(7460, chaox.id);
            Assert.Equal(37872485, freshYoloSwag.id);

            List <string> summonerNames3 = new List <string>();

            for (int i = 0; i < 41; i++)
            {
                summonerNames3.Add("");
            }
            await Assert.ThrowsAsync <CreepScoreException>(async() => await creepScore.RetrieveSummoners(CreepScore.Region.NA, summonerNames3));
        }