예제 #1
0
        public void SetNoCacheHeaders_DisabledInConfig_DoesNothing()
        {
            _config.NoCacheHttpHeaders.Enabled = false;

            _configHeaderSetter.SetNoCacheHeadersFromConfig(_httpContext, _nwebsecContext);

            Assert.Null(_nwebsecContext.NoCacheHeaders);
            Mock.Get(_httpContext).Verify(ctx => ctx.SetNoCacheHeaders(), Times.Never);
        }
예제 #2
0
        public void SetNoCacheHeaders_DisabledInConfig_DoesNothing()
        {
            var cachePolicy = new Mock <HttpCachePolicyBase>();

            _mockResponse.Setup(x => x.Cache).Returns(cachePolicy.Object);

            _configHeaderSetter.SetNoCacheHeadersFromConfig(_mockContext, _nwebsecContext);

            Assert.IsNull(_nwebsecContext.NoCacheHeaders);
            cachePolicy.Verify(c => c.SetCacheability(It.IsAny <HttpCacheability>()), Times.Never());
            cachePolicy.Verify(c => c.SetNoStore(), Times.Never());
            cachePolicy.Verify(c => c.SetRevalidation(It.IsAny <HttpCacheRevalidation>()), Times.Never());
            Assert.IsEmpty(_responseHeaders);
        }