Beispiel #1
0
        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));
        }
Beispiel #2
0
        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());
        }
Beispiel #3
0
        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());
        }