public void CreateQuery_returns_a_query_with_the_Fetchers_Context_and_Uri() { var query = _fetcher.CreateQuery <Product, IProduct>(); query.Context .Should().Be(_context); query.Query.RequestUri .Should().Be(_fetcher.GetUrl()); }
public void When_the_path_has_a_trailing_slash_GetUrl_returns_the_path_appended_to_the_Context_base_uri_with_a_single_slash() { var baseUriString = Any.Uri(allowQuerystring: false).AbsoluteUri.TrimEnd('/'); var context = new DataServiceContextWrapper(new Uri(baseUriString + "/"), Any.EnumValue <ODataProtocolVersion>(), () => Task.FromResult(Any.String())); var fetcher = new TestRestShallowObjectFetcher(); fetcher.Initialize(context, _path); fetcher.GetUrl().AbsoluteUri .Should().Be(new Uri(baseUriString + "/" + _path).AbsoluteUri); }
public void GetUrl_throws_InvalidOperationException() { Action callCreateQuery = () => _fetcher.GetUrl(); callCreateQuery.ShouldThrow <InvalidOperationException>(); }