Example #1
0
        public void Scheme(UrlTestData urlData)
        {
            // Fixture setup
            // Exercise system
            var url = AbsoluteUrl.Create(urlData.Url);

            // Verify outcome
            Assert.Equal(urlData.Scheme, url.Scheme);
            // Teardown
        }
Example #2
0
        public void HasParameter(string urlText, string parameter, bool expectedResult)
        {
            // Fixture setup
            // Exercise system
            var url = AbsoluteUrl.Create(urlText);

            // Verify outcome
            Assert.Equal(expectedResult, url.HasParameter(parameter));
            // Teardown
        }
Example #3
0
        public void IsHttps_AbsoluteUrl(string urlText, bool expectedResult)
        {
            // Fixture setup
            // Exercise system
            var url = AbsoluteUrl.Create(urlText);

            // Verify outcome
            Assert.Equal(expectedResult, url.IsHttps);
            // Teardown
        }
Example #4
0
        public void Normalized(UrlTestData urlData)
        {
            // Fixture setup
            // Exercise system
            var url = AbsoluteUrl.Create(urlData.Url);

            // Verify outcome
            Assert.Equal(urlData.Normalized, url.ToString());
            // Teardown
        }
Example #5
0
        //[InlineData("http://192.168.1.1/", true)]
        public void IsDomainIPAddress(string urlText, bool expectedIsIPAddress)
        {
            // Fixture setup
            // Exercise system
            var url = AbsoluteUrl.Create(urlText);

            // Verify outcome
            Assert.Equal(expectedIsIPAddress, url.IsDomainAnIPAddress);
            // Teardown
        }
Example #6
0
        public void SecondLevelDomain(string urlText, string expectedSecondLevelDomain)
        {
            // Fixture setup
            // Exercise system
            var url = AbsoluteUrl.Create(urlText);

            // Verify outcome
            Assert.Equal(expectedSecondLevelDomain, url.SecondLevelDomain);
            // Teardown
        }
Example #7
0
        public void Fragment(UrlTestData urlData)
        {
            // Fixture setup
            // Exercise system
            var url = AbsoluteUrl.Create(urlData.Url);

            // Verify outcome
            Assert.Equal(urlData.Fragment, url.Fragment);
            // Teardown
        }
Example #8
0
        public void RemoveParameter(string urlText, string parameter, string expectedQuery, string expectedPathAndQuery, string expectedPathAndQueryAndFragment)
        {
            // Fixture setup
            // Exercise system
            var url = AbsoluteUrl.Create(urlText).RemoveParameter(parameter);

            // Verify outcome
            Assert.Equal(expectedQuery, url.Query);
            Assert.Equal(expectedPathAndQuery, url.PathAndQuery);
            Assert.Equal(expectedPathAndQueryAndFragment, url.PathAndQueryAndFragment);
            // Teardown
        }
Example #9
0
        public void FileName_HasFileName_And_Extension_HasExtension(string urlText, string expectedFileName, bool expectedHasFileName, string expectedExtension, bool expectedHasExtension)
        {
            // Fixture setup
            // Exercise system
            var url = AbsoluteUrl.Create(urlText);

            // Verify outcome
            Assert.Equal(expectedFileName, url.FileName);
            Assert.Equal(expectedHasFileName, url.HasFileName);
            Assert.Equal(expectedExtension, url.Extension);
            Assert.Equal(expectedHasExtension, url.HasExtension);
            // Teardown
        }
Example #10
0
        public void Create()
        {
            // Fixture setup
            // Exercise system
            var url = AbsoluteUrl.Create("http://*****:*****@example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose");

            // Verify outcome
            Assert.Equal("http", url.Scheme);
            Assert.Equal("username:password", url.UserInfo);
            Assert.Equal("example.com", url.Host);
            Assert.Equal(8042, url.Port);
            Assert.Equal("/over/there/index.dtb", url.Path);
            Assert.Equal("type=animal&name=narwhal", url.Query);
            Assert.Equal("nose", url.Fragment);
            Assert.Equal("index.dtb", url.FileName);
            Assert.Equal(".dtb", url.Extension);
            // Teardown
        }