public void CreateUri3_append_relative_path_2() { var builder = new UriBuilder("foo.com") { Scheme = "https", Port = 4321, Path = "/a" }; Assert.AreEqual("/a", builder.Path); builder.PathAppend("/////somepath/somefile.htm"); Assert.AreEqual("https://foo.com:4321/a/somepath/somefile.htm", builder.Uri.AbsoluteUri); }
public static string CombineUris(this string uri, string relativePathToAppend) { var builder = new UriBuilder(uri); builder.PathAppend(relativePathToAppend); return builder.Uri.AbsoluteUri; }
public void Add_slash_only_adds_slash_and_append_works() { var builder = new UriBuilder("foo.com") { Path = "a" }; builder.Path += "/"; builder.PathAppend("b/"); Assert.AreEqual("http://foo.com/a/b/", builder.Uri.AbsoluteUri); }