コード例 #1
0
        public void IsLocal_should_return_false_if_userHostAddr_is_not_localhost()
        {
            // Given when
            var request = new FakeRequest("GET", "/", string.Empty, "86.13.73.12");

            // Then
            Assert.False(request.IsLocal());
        }
コード例 #2
0
        public void IsLocal_should_return_false_if_urlString_is_empty()
        {
            // Given when
            var request = new FakeRequest("GET", string.Empty, string.Empty, string.Empty);

            // Then
            Assert.False(request.IsLocal());
        }
コード例 #3
0
        public void IsLocal_should_return_true_if_userHostAddr_is_localhost_IPV4()
        {
            // Given when
            var request = new FakeRequest("POST", "/", string.Empty, "127.0.0.1");

            // Then
            Assert.True(request.IsLocal());
        }
コード例 #4
0
        public void IsLocal_should_return_false_if_urlString_is_empty()
        {
            // Given when
            var request = new FakeRequest("GET", string.Empty, string.Empty, string.Empty);

            // Then
            Assert.False(request.IsLocal());
        }
コード例 #5
0
 public void IsLocal_should_return_true_if_userHostAddr_is_localhost_IPV4()
 {
     // Given when
     var request = new FakeRequest("POST", "/", string.Empty, "127.0.0.1");
     request.Url.HostName = "localhost";
     
     // Then
     Assert.True(request.IsLocal());
 }
コード例 #6
0
        public void IsLocal_should_return_true_if_userHostAddr_is_localhost_IPV6()
        {
            // Given when
            var request = new FakeRequest("GET", "/", string.Empty, "::1");

            request.Url.HostName = "localhost";

            // Then
            Assert.True(request.IsLocal());
        }
コード例 #7
0
        public void IsLocal_should_return_false_if_userHostAddr_is_not_localhost()
        {
            // Given when
            var request = new FakeRequest("GET", "/", string.Empty, "86.13.73.12");
            request.Url.HostName = "anotherhost";

            // Then
            Assert.False(request.IsLocal());
        }