//Get a champion mastery by player ID and champion ID public async Task <ChampionMasteryDTO> GetChampionMasteriesByChampionAsync(long summonerID, long championID) { ChampionMasteryDTO championMastery = null; string request = "/lol/champion-mastery/" + CM_VERSION + "/champion-masteries/by-summoner/" + summonerID + "/by-champion/" + championID; string response = await GET(request); championMastery = JsonConvert.DeserializeObject <ChampionMasteryDTO>(response); return(championMastery); }
public async Task GetMasterySuccess() { using (var httpTest = new HttpTest()) { //Arrange var playerName = "TestingPlayer"; var regionName = "eune"; var championName = "Test"; var championId = 10; var player = new SummonerDTO { Id = Guid.NewGuid().ToString() }; var championDTOs = new ChampionDTO[] { new ChampionDTO { Name = "Test", Id = championId } }; var championMasteryDTO = new ChampionMasteryDTO { ChampionLevel = 1, ChampionPoints = "2000" }; var memoryCache = new MemoryCache(new MemoryCacheOptions()); var mockIConfigration = new Mock <IConfiguration>(); mockIConfigration.Setup(c => c[Constants.RIOT_APIKEY]).Returns("RiotApiKey"); var riotApiService = new RiotApiService(memoryCache, mockIConfigration.Object); httpTest.RespondWithJson(player, 200); httpTest.RespondWithJson(championDTOs, 200); httpTest.RespondWithJson(championMasteryDTO, 200); //Act var result = await riotApiService.GetMastery(playerName, regionName, championName); //Assert httpTest.ShouldHaveCalled($"http://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default/v1/champion-summary.json") .WithVerb(HttpMethod.Get) .Times(1); httpTest.ShouldHaveCalled($"https://eun1.api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-summoner/{player.Id}/by-champion/{championId}") .WithQueryParams("api_key") .WithVerb(HttpMethod.Get) .Times(1); Assert.Equal($"Champion level {championMasteryDTO.ChampionLevel} with {championName} ({championMasteryDTO.ChampionPoints ?? "0"} points)", result); } }
public ChampionMasteryBinding(ChampionMasteryDTO championMasteryDto) { m_championMasteryDto = championMasteryDto; }
public MelhoresCampeoes(ChampionMasteryDTO championMasteryDTO) { idCampeao = championMasteryDTO.championId; levelMaestria = championMasteryDTO.championLevel; pontosMaestria = championMasteryDTO.championPoints; }