コード例 #1
0
        public void SetHstsHeader_HttpAndNoHttpsOnly_HandlesResult(bool uaSupportsUpgrade)
        {
            _config.SecurityHttpHeaders.Hsts.HttpsOnly = false;
            _mockHeaderGenerator.Setup(g => g.CreateHstsResult(_config.SecurityHttpHeaders.Hsts)).Returns(_expectedHeaderResult);

            _configHeaderSetter.SetHstsHeader(_httpContext, false, uaSupportsUpgrade);

            _mockHeaderResultHandler.Verify(h => h.HandleHeaderResult(_httpContext, _expectedHeaderResult), Times.Once);
        }
コード例 #2
0
        public void SetHstsHeader_HttpAndNoHttpsOnly_HandlesResult()
        {
            _config.SecurityHttpHeaders.Hsts.HttpsOnly = false;
            _mockHeaderGenerator.Setup(g => g.CreateHstsResult(_config.SecurityHttpHeaders.Hsts)).Returns(_expectedHeaderResult);

            _configHeaderSetter.SetHstsHeader(_mockResponse.Object, false);

            _mockHeaderResultHandler.Verify(h => h.HandleHeaderResult(It.IsAny <HttpResponseBase>(), _expectedHeaderResult), Times.Once);
        }