public void Test_ConvertRelativeUrlToAbsoluteUrl_WithoutPreceedingSlash() { string url = "Folder1/folder2/file.html";//HttpContext.Current.Request.Url.ToString(); string expected = "http://localhost/Folder1/folder2/file.html"; UrlConverter converter = new UrlConverter("/"); converter.Protocol = "http"; converter.Host = "localhost"; string result = converter.ToAbsolute(url); Assert.AreEqual(expected, result, "Doesn't match."); }
public void Test_ToAbsolute() { string url = "/Folder1/folder2/file.html";//HttpContext.Current.Request.Url.ToString(); string expected = "http://localhost/Folder1/folder2/file.html"; //string protocol = "http"; //string host = "localhost"; UrlConverter converter = new UrlConverter(ApplicationPath); converter.Protocol = "http"; converter.Host = "localhost"; string result = converter.ToAbsolute(url); Assert.AreEqual(expected, result, "Doesn't match."); }