コード例 #1
0
            public void GivenFTPUrlWithPathFromExplain_ShouldReturnCorrectUrlParts()
            {
                //Arrange
                var url       = "ftp://foo.com:9000/files";
                var urlHelper = UrlHelper();
                //Act
                var urlParts = urlHelper.GetUrlParts(url);
                //Assert
                var expected = new UrlParts()
                {
                    Protocol  = "ftp",
                    Subdomain = string.Empty,
                    Domain    = "foo.com",
                    Path      = "files",
                    Port      = "9000"
                };

                Assert.That(urlParts, Is.EqualTo(expected));
            }
コード例 #2
0
            public void GivenHttpUrlWithPathFromExplain_ShouldReturnCorrectUrlParts()
            {
                //Arrange
                var url       = "http://foo.bar.com/foobar.html";
                var urlHelper = UrlHelper();
                //Act
                var urlParts = urlHelper.GetUrlParts(url);
                //Assert
                var expected = new UrlParts()
                {
                    Protocol  = "http",
                    Subdomain = "foo",
                    Domain    = "bar.com",
                    Path      = "foobar.html",
                    Port      = "80"
                };

                Assert.That(urlParts, Is.EqualTo(expected));
            }
コード例 #3
0
            public void GivenHttpsUrlWithPathFromExplain_ShouldReturnCorrectUrlParts()
            {
                //Arrange
                var url       = "https://www.foobar.com:8080/download/install.exe";
                var urlHelper = UrlHelper();
                //Act
                var urlParts = urlHelper.GetUrlParts(url);
                //Assert
                var expected = new UrlParts()
                {
                    Protocol  = "https",
                    Subdomain = "www",
                    Domain    = "foobar.com",
                    Path      = "download/install.exe",
                    Port      = "8080"
                };

                Assert.That(urlParts, Is.EqualTo(expected));
            }
コード例 #4
0
            public void GivenHttpUrlFromExplain_ShouldReturnCorrectUrlParts()
            {
                //Arrange
                var url       = "http://www.tddbuddy.com";
                var urlHelper = UrlHelper();
                //Act
                var urlParts = urlHelper.GetUrlParts(url);
                //Assert
                var expected = new UrlParts()
                {
                    Protocol  = "http",
                    Subdomain = "www",
                    Domain    = "tddbuddy.com",
                    Path      = string.Empty,
                    Port      = "80"
                };

                Assert.That(urlParts, Is.EqualTo(expected));
            }