コード例 #1
0
        public async Task ReadShouldPassTheUriOn()
        {
            var disabled = new DisabledCacheProvider();

            HttpRequestMessage request = new HttpRequestMessage();
            request.Method = HttpMethod.Get;
            HttpResponseMessage response = new HttpResponseMessage();
            response.Content = testContent;
            this.http.Setup(h => h.SendOriginalAsync()).Returns(() => Task.FromResult(response));
            this.http.SetupGet(h => h.OriginalRequest).Returns(request);

            HttpContent content = await disabled.Read(testUri, this.http.Object);

            Assert.AreEqual(testUri, request.RequestUri);
            Assert.AreEqual(testContent, content);
            Assert.AreEqual(HttpMethod.Get, request.Method);
        }
コード例 #2
0
        public async Task UpdateShouldPassTheUriAndContentOn()
        {
            var disabled = new DisabledCacheProvider();

            HttpRequestMessage request = new HttpRequestMessage();
            request.Method = new HttpMethod("PATCH");
            HttpResponseMessage response = new HttpResponseMessage();
            response.Content = testContent;
            this.http.Setup(h => h.SendOriginalAsync()).Returns(() => Task.FromResult(response));
            this.http.SetupGet(h => h.OriginalRequest).Returns(request);

            HttpContent result = await disabled.Update(testUri, testContent, this.http.Object);

            Assert.AreEqual(testUri, request.RequestUri);
            Assert.AreEqual(testContent, request.Content);
            Assert.AreEqual(new HttpMethod("PATCH"), request.Method);
            Assert.AreEqual(testContent, result);
        }
コード例 #3
0
        public void DisabledCacheProviderDoesNotCacheForUri()
        {
            var disabled = new DisabledCacheProvider();

            Assert.IsFalse(disabled.ProvidesCacheForRequest(testUri));
        }