public void IsLocalUrlShouldReturnTrueWhenAuthoritiesMatch()
        {
            var request = new StubHttpRequest();
            request.Headers.Add("Host", "localhost");

            Assert.That(request.IsLocalUrl("http://localhost"), Is.True);
        }
        public void IsLocalUrlShouldReturnFalseForEverythingElse()
        {
            var request = new StubHttpRequest();
            request.Headers.Add("Host", "localhost");

            Assert.That(request.IsLocalUrl("abc"), Is.False);
        }
        public void IsLocalUrlShouldReturnFalseWhenUrlIsNullOrEmpty()
        {
            var request = new StubHttpRequest();

            Assert.That(request.IsLocalUrl(null), Is.False);
            Assert.That(request.IsLocalUrl("   "), Is.False);
            Assert.That(request.IsLocalUrl(""), Is.False);
        }
        public void IsLocalUrlShouldReturnFalseWhenAuthoritiesDiffer()
        {
            var request = new StubHttpRequest();
            request.Headers.Add("Host", "localhost");

            Assert.That(request.IsLocalUrl("http://somedomain"), Is.False);
            Assert.That(request.IsLocalUrl("http://localhost:8080"), Is.False);
        }
        public void IsLocalUrlShouldReturnTrueWhenUrlStartsWithSlashAndAnythingElse()
        {
            var request = new StubHttpRequest();

            Assert.That(request.IsLocalUrl("/"), Is.True);
            Assert.That(request.IsLocalUrl("/контакты"), Is.True);
            Assert.That(request.IsLocalUrl("/  "), Is.True);
            Assert.That(request.IsLocalUrl("/abc-def"), Is.True);
        }
        public void IsLocalUrlShouldReturnFalseWhenUrlStartsWithForwardBackwardSlash()
        {
            var request = new StubHttpRequest();

            Assert.That(request.IsLocalUrl("/\\"), Is.False);
        }
        public void IsLocalUrlShouldReturnFalseWhenUrlStartsWithDoubleSlash()
        {
            var request = new StubHttpRequest();

            Assert.That(request.IsLocalUrl("//"), Is.False);
        }
Esempio n. 8
0
        public void IsLocalUrlShouldReturnFalseWhenUrlStartsWithForwardBackwardSlash()
        {
            var request = new StubHttpRequest();

            Assert.That(request.IsLocalUrl("/\\"), Is.False);
        }
Esempio n. 9
0
        public void IsLocalUrlShouldReturnFalseWhenUrlStartsWithDoubleSlash()
        {
            var request = new StubHttpRequest();

            Assert.That(request.IsLocalUrl("//"), Is.False);
        }