Beispiel #1
0
        public ChampionRotation GetChampionRotation(region region, bool onlyFreeToPlay = true, bool useCaching = false)
        {
            ChampionRotation val = Cache.Get <ChampionRotation>(region.ToString(), onlyFreeToPlay.ToString()); //cache getting

            if (val != null)
            {
                return(val);
            }

            RiotApiCaller <ChampionRotation> caller = new RiotApiCaller <ChampionRotation>(suffix.championRotation);

            caller.AddParam(param.region, region);
            caller.AddParam(param.freeToPlay, onlyFreeToPlay);

            if (useCaching)
            {
                Cache.AddOrUpdate(caller.CreateRequest(new System.TimeSpan(0, 22, 0)));
            }
            else
            {
                caller.CreateRequest();
            }

            return(caller.Result.FirstOrDefault());
        }
        public void GetChampionRotation()
        {
            ApiService.ApiKey = APIKEY;//you must add your project, if you dont use ninject
            NonStaticApi     api  = new NonStaticApi(new Api.Cache.ApiCache());
            ChampionRotation data = api.GetChampionRotation(region.tr, true);

            Assert.IsTrue(data.Champions.Count > 0);
        }
Beispiel #3
0
        public async void Return_Correct_Champion_Rotation(Region region)
        {
            ChampionRotation rotation = await RiotAPI.Champions.GetChampionRotation(region);

            Check.That(rotation).IsNotNull();
            Check.That(rotation.FreeChampions).IsNotEmpty();
            Check.That(rotation.FreeChampionsForNewPlayers).IsNotEmpty();
            Check.That(rotation.MaxNewPlayerLevel).IsStrictlyGreaterThan(0);
        }