Beispiel #1
0
 public void MoreThanLimitSent_DoesNotThrow()
 {
     for (int i = 0; i < 15; i++)
     {
         Assert.DoesNotThrow(() => RequestRateHttpClient.GetRequest(new Uri(DummyMatchesForPlayerEndpoint)));
     }
 }
Beispiel #2
0
        public async Task <T> ProcessRequest <T>(Uri endpoint, int cacheExpiryMin) where T : class
        {
            string key = endpoint.AbsoluteUri;

            if (CacheManager.Contains(key))
            {
                return(CacheManager.Get <T>(key));
            }
            var message = await RequestRateHttpClient.GetRequest(endpoint);

            var messageObject = await HandleResponse <T>(message);

            CacheManager.Add <T>(messageObject, key, cacheExpiryMin);
            return(messageObject);
        }
Beispiel #3
0
        public async Task <Image> ProcessImageRequest(Uri endpoint, int cacheExpiryMin, bool bustCache = false)
        {
            string key = endpoint.AbsoluteUri;

            if (!bustCache && _apiCache.Contains(key))
            {
                return(_apiCache.Get <Image>(key));
            }
            if (bustCache)
            {
                _apiCache.Remove(key);
            }
            var message = await RequestRateHttpClient.GetRequest(endpoint);

            var messageObject = await HandleImageResponse(message);

            _apiCache.Add <Image>(messageObject, key, cacheExpiryMin);
            return(messageObject);
        }
Beispiel #4
0
 public void Default_DoesNotThrow()
 {
     Assert.DoesNotThrow(() => RequestRateHttpClient.GetRequest(new Uri(DummyMatchesForPlayerEndpoint)));
 }