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)); }
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)); }
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)); }
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)); }