Пример #1
0
        public void ParsesHttpNoPortWithHost()
        {
            var parser  = new WebSiteBindingParser();
            var binding = parser.Parse("http://example.com/");

            Assert.That(binding.Port, Is.EqualTo(80));
            Assert.That(binding.Host, Is.EqualTo("example.com"));
            Assert.That(binding.Protocol, Is.EqualTo("http"));
            Assert.That(binding.Path, Is.Null);
        }
Пример #2
0
        public void ParsesHttpsPort4000WithHostAndPath()
        {
            var parser  = new WebSiteBindingParser();
            var binding = parser.Parse("https://example.com:4000/path/to/website");

            Assert.That(binding.Port, Is.EqualTo(4000));
            Assert.That(binding.Host, Is.EqualTo("example.com"));
            Assert.That(binding.Protocol, Is.EqualTo("https"));
            Assert.That(binding.Path, Is.EqualTo("/path/to/website"));
        }
Пример #3
0
        public void ParsesHttpPort4000WithoutHost()
        {
            var parser  = new WebSiteBindingParser();
            var binding = parser.Parse("http://*:4000/");

            Assert.That(binding.Port, Is.EqualTo(4000));
            Assert.That(binding.Host, Is.Null);
            Assert.That(binding.Protocol, Is.EqualTo("http"));
            Assert.That(binding.Path, Is.Null);
        }
Пример #4
0
        public void ParsesHttpWithIpAddress()
        {
            var parser  = new WebSiteBindingParser();
            var binding = parser.Parse("https://127.0.0.1:4000/");

            Assert.That(binding.Port, Is.EqualTo(4000));
            Assert.That(binding.IpAddress, Is.EqualTo(new IPAddress(new byte[] { 127, 0, 0, 1 })));
            Assert.That(binding.Host, Is.Null);
            Assert.That(binding.Protocol, Is.EqualTo("https"));
            Assert.That(binding.Path, Is.Null);
        }