Beispiel #1
0
        public ChampionStatus GetChampionRotationById(region region, long championId, bool useCaching = false)
        {
            ChampionStatus val = Cache.Get <ChampionStatus>(championId.ToString(), region.ToString()); //cache getting

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

            RiotApiCaller <ChampionStatus> caller = new RiotApiCaller <ChampionStatus>(suffix.championRotationId);

            caller.AddParam(param.region, region);
            caller.AddParam(param.id, championId);

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

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

            Assert.IsNotNull(data);
        }