public void RequestUriNoBasePath() { var request = new FluentRequest(); var builder = new QueryBuilder(request); builder.AppendPath("http://test.com/api/v1"); Assert.Throws <FluentException>(() => request.RequestUri()); }
public void AppendPathWithTrailingSlash() { var request = new FluentRequest(); var builder = new QueryBuilder(request); builder.BaseUri("http://test.com/api/").AppendPath("v1"); var url = request.RequestUri(); Assert.Equal("http://test.com/api/v1", url.ToString()); }
public void RequestUriInvalidUri() { var request = new FluentRequest(); var builder = new QueryBuilder(request); var baseUri = new Uri("/api", UriKind.Relative); Assert.Throws <UriFormatException>(() => { builder.BaseUri(baseUri).AppendPath("v1"); var uri = request.RequestUri(); }); }
public void QueryStringNull() { var request = new FluentRequest(); var builder = new QueryBuilder(request); string value = null; builder.BaseUri("http://test.com/"); builder.QueryString("Test", value); var uri = request.RequestUri(); Assert.Equal("http://test.com/?Test=", uri.ToString()); }
public void QueryStringMultipleValue() { var request = new FluentRequest(); var builder = new QueryBuilder(request); builder.BaseUri("http://test.com/"); builder.QueryString("Test", "Test1"); builder.QueryString("Test", "Test2"); var uri = request.RequestUri(); Assert.Equal("http://test.com/?Test=Test1&Test=Test2", uri.ToString()); }
public void RequestUriInvalidUri() { var request = new FluentRequest(); var builder = new QueryBuilder(request); var baseUri = new Uri("/api", UriKind.Relative); Assert.Throws<UriFormatException>(() => { builder.BaseUri(baseUri).AppendPath("v1"); var uri = request.RequestUri(); }); }
public void RequestUriNoBasePath() { var request = new FluentRequest(); var builder = new QueryBuilder(request); builder.AppendPath("http://test.com/api/v1"); Assert.Throws<FluentException>(() => request.RequestUri()); }