コード例 #1
0
        public void ResponseBodyNotSuppressedForViewIfRequestIfNoneMatchNotEqualsResponseEtag()
        {
            var headers = new System.Net.WebHeaderCollection()
            {
                { "If-None-Match", "NOT_VIEW_ETAG" }
            };
            var mock_controller_context = CacheUtilsTest.SetupMockControllerHeaders(headers);
            var response = CacheUtils.MaybeSuppressResponseBodyForView(mock_controller_context, view_contents);

            Assert.AreNotEqual(new byte[0], response);
            Assert.AreEqual(response, view_contents);
        }
コード例 #2
0
        public void ResponseBodySuppressedForViewIfRequestIfNoneMatchEqualsResponseEtagAndItemIsCached()
        {
            var headers = new System.Net.WebHeaderCollection()
            {
                { "If-None-Match", view_etag }
            };
            var mock_controller_context = CacheUtilsTest.SetupMockControllerHeaders(headers);
            var cache = new MockCache();

            cache[view_uri.ToString()] = view_contents;
            var response = CacheUtils.MaybeSuppressResponseBodyForView(mock_controller_context, view_contents);

            Assert.AreEqual(new byte[0], response);
        }