public void TestCreateUriWithParametersAreNull() { // Arrange var baseUri = new Uri("http://a.com"); // Act & Assert Assert.AreEqual("http://a.com/", HttpRequestService.CreateUri(baseUri, null, null, null).ToString()); Assert.AreEqual("http://a.com/", HttpRequestService.CreateUri(baseUri, Enumerable.Empty <string>(), new NameValueCollection(), string.Empty).ToString()); }
public void TestCreateUri() { // Arrange var baseUri = new Uri("http://a.com"); IEnumerable <string> pathInfos = new List <string> { "a 1", "b 2" }; var queryStrings = new NameValueCollection { { "c 3", "d 4" }, }; const string Fragment = "e 5"; // Act var uri = HttpRequestService.CreateUri(baseUri, pathInfos, queryStrings, Fragment); // Assert Assert.AreEqual("http://a.com/a+1/b+2?c+3=d+4#e+5", uri.ToString()); }