public async void Put_valid_request_returns_response_not_cached_should_add_to_cache()
        {
            // arrange
            var responseObj = _fixture.Create<RandomObject>();
            var requestObj = _fixture.Create<RandomObject>();
            _cachedObject = null;

            _httpCachingService.Setup(x => x.CheckCache(_baseAddress, _uri, _headers, CheckCache))
                               .Returns(Task.FromResult((RandomObject)null));


            _httpService.Setup(
                               x =>
                               x.CallHttpMethod<RandomObject, RandomObject>(_baseAddress, _uri, requestObj, _headers, HttpMethods.PUT))
                        .Returns(Task.FromResult(responseObj));

            // act
            var response = await _sut.Put(_baseAddress, _uri, requestObj, _headers, CheckCache);

            // assert
            _httpCachingService.Verify(
                                       x =>
                                       x.AddToCache(It.IsAny<RandomObject>(), _baseAddress,
                                                   _uri, _headers, null), Times.Once);

        }
        public async void Put_valid_request_cached_should_return_cache_not_hit_CallHttpMethod()
        {
            // arrange
            var responseObj = _fixture.Create<RandomObject>();
            var requestObj = _fixture.Create<RandomObject>();

            _cachedObject = responseObj;

            _httpCachingService.Setup(
                                      x =>
                                      x.CheckCache(_baseAddress, _uri, _headers, It.IsAny<Func<string, Task<RandomObject>>>()))
                               .Returns(Task.FromResult(_cachedObject));

            // act
            var response = await _sut.Put(_baseAddress, _uri, requestObj, _headers, CheckCache);

            // assert
            _httpService.Verify(x => x.CallHttpMethod<RandomObject, RandomObject>(_baseAddress, _uri, requestObj, _headers, HttpMethods.PUT), Times.Never);
            response.BackInTime.Should().Be(_cachedObject.BackInTime);
        }
 private async Task SetCache(RandomObject obj, string key)
 {
     _cache.Add(key, obj);
 }