コード例 #1
0
        public void RetrieveAllChampionsBehaviour()
        {
            //Arrange
            _mockClient.Setup(x => x.Champion.RetrieveAllChampions(It.IsAny <RiotApiConfig.Regions>(), It.IsAny <bool>()))
            .Returns(new ChampionListDto());

            //Act
            IRiotClient     client = _mockClient.Object;
            ChampionListDto dto    = client.Champion.RetrieveAllChampions(RiotApiConfig.Regions.EUNE, true);

            //Assert
            Assert.IsInstanceOf <ChampionListDto>(dto);
            Assert.NotNull(dto);
        }
コード例 #2
0
ファイル: ChampionsController.cs プロジェクト: aybbr/gcomm
        private void PrepareModel(ChampionsModel model, RiotDtos.Champion.ChampionListDto championListDto,
                                  RiotDtos.LolStaticData.Champion.ChampionListDto staticChampionListDto)
        {
            var ddragonKeyVersionsKey = string.Format(CacheKeys.DataDragonVersionByRegionKey, model.Region);
            var ddragonVersions       = _memoryCache.Get(ddragonKeyVersionsKey, DateTime.UtcNow.AddDays(1),
                                                         () => _riotClient.LolStaticData.GetVersionData(model.Region));

            model.ChampionModels = new List <ChampionsModel.ChampionModel>();

            foreach (var championDto in championListDto.Champions)
            {
                ChampionsModel.ChampionModel championModel = new ChampionsModel.ChampionModel();
                var ddVersions = ddragonVersions as IList <string> ?? ddragonVersions.ToList();
                PrepareDetailsModel(championModel, championDto,
                                    staticChampionListDto.Data.Values.FirstOrDefault(x => x.Id == championDto.Id), ddVersions);
                model.ChampionModels.Add(championModel);
            }
        }