コード例 #1
0
        public void LocalAddress_AssertNullLocalIpAddressReturnsNull()
        {
            var segement = new LocalAddressSegment();
            var context  = new RewriteContext {
                HttpContext = new DefaultHttpContext()
            };

            context.HttpContext.Connection.LocalIpAddress = null;
            // Act
            var results = segement.Evaluate(context, null, null);

            // Assert
            Assert.Null(results);
        }
コード例 #2
0
        public void LocalAddress_AssertSegmentIsCorrect()
        {
            // Arrange
            var segement = new LocalAddressSegment();
            var context  = new RewriteContext {
                HttpContext = new DefaultHttpContext()
            };

            context.HttpContext.Connection.LocalIpAddress = IPAddress.Parse("20.30.40.50");
            // Act
            var results = segement.Evaluate(context, null, null);

            // Assert
            Assert.Equal("20.30.40.50", results);
        }