示例#1
0
        public void HttpContextService_IsHttps_NoXForwardedProtoHeaderSet_ShouldReturnOriginalIsHttps()
        {
            // arrange
            _mockHttpContext.SetHttps(true);
            _mockHttpContext.SetIp("11.22.33.44");

            // act
            bool result = _service.IsHttps();

            // assert
            Assert.IsTrue(result);
        }
        public void ClientDataResolver_IsHttps_IpIsNotLoopback_ForwardedHeaderNotSet_Https_ShouldReturnTrue()
        {
            // Arrange
            const string loopbackIp = "123.123.123.123";

            _mockContext.SetIp(loopbackIp);

            _mockContext.SetHttps(true);

            // Act
            var isHttps = _resolver.IsHttps();

            // Assert
            Assert.IsTrue(isHttps);
        }