public void ThrowsWithNullBaseAddressAndNullPath() { var requester = new PublicRequester(new HttpClient() { BaseAddress = null }); var requestInfo = new RequestInfo(HttpMethod.Get, null); Assert.Throws <FormatException>(() => requester.ConstructUri(null, null, requestInfo)); }
public void AllowsNullBaseAddressAndNonNullPath() { var requester = new PublicRequester(new HttpClient() { BaseAddress = null }); var requestInfo = new RequestInfo(HttpMethod.Get, null); var uri = requester.ConstructUri(null, "foo", requestInfo); Assert.Equal("http://foo/", uri.ToString()); }
public void CombinesUriParts(string baseAddress, string basePath, string path, string expected) { var requester = new PublicRequester(new HttpClient() { BaseAddress = baseAddress == null ? null : new Uri(baseAddress), }); var requestInfo = new RequestInfo(HttpMethod.Get, path) { BasePath = basePath }; var uri = requester.ConstructUri(basePath, path, requestInfo); Assert.Equal(expected, uri.ToString()); }