public void AbsoluteUri_Template_Query_DeferredValues() { string action = "foo"; string id = "bar"; bool? flag = true; HttpRequest request = HttpRequest.Factory.Create("http://localhost:1234/") .WithRelativeUri("{action}/{id}?flag={flag?}") .WithTemplateParameter("action", () => action) .WithTemplateParameter("id", () => id) .WithTemplateParameter("flag", () => flag); RequestAssert.MessageHasUri(request, expectedUri: "http://localhost:1234/foo/bar?flag=True" ); action = "diddly"; id = "dee"; flag = null; RequestAssert.MessageHasUri(request, expectedUri: "http://localhost:1234/diddly/dee" ); }
public void AbsoluteUri_BaseUri_UsesRequestUri() { Uri baseUri = new Uri("http://tintoy.io:5678/"); RequestAssert.MessageHasUri(AbsoluteRequest, baseUri, expectedUri: AbsoluteRequest.Uri ); }
public void RelativeUri_BaseUri_PrependsBaseUri() { Uri baseUri = new Uri("http://tintoy.io:5678/"); RequestAssert.MessageHasUri(RelativeRequest, baseUri, expectedUri: new Uri(baseUri, RelativeRequest.Uri) ); }
public void AbsoluteUri_WithQuery_AddQuery_EmptyPath() { HttpRequest request = AbsoluteRequest.WithRelativeUri("foo/bar?baz=bonk") .WithRelativeUri("?bo=diddly"); RequestAssert.MessageHasUri(request, expectedUri: "http://localhost:1234/foo/bar?baz=bonk&bo=diddly" ); }
public void AbsoluteUri_Query() { HttpRequest request = HttpRequest.Factory.Create("http://localhost:1234/foo/bar") .WithQueryParameter("flag", true); RequestAssert.MessageHasUri(request, expectedUri: "http://localhost:1234/foo/bar?flag=True" ); }
public void Absoluteuri_Template() { HttpRequest request = HttpRequest.Factory.Create("http://localhost:1234/{action}/{id}") .WithTemplateParameter("action", "foo") .WithTemplateParameter("id", "bar"); RequestAssert.MessageHasUri(request, expectedUri: "http://localhost:1234/foo/bar" ); }
public void AbsoluteUri_AddQuery_DeferredValues() { bool?flag = true; HttpRequest request = HttpRequest.Factory.Create("http://localhost:1234/foo/bar") .WithQueryParameter("flag", () => flag); RequestAssert.MessageHasUri(request, expectedUri: "http://localhost:1234/foo/bar?flag=True" ); flag = null; RequestAssert.MessageHasUri(request, expectedUri: "http://localhost:1234/foo/bar" ); }
public void AbsoluteUri_Template_DeferredValues() { string action = "foo"; string id = "bar"; HttpRequest request = HttpRequest.Factory.Create("http://localhost:1234/{action}/{id}") .WithTemplateParameter("action", () => action) .WithTemplateParameter("id", () => id); RequestAssert.MessageHasUri(request, expectedUri: "http://localhost:1234/foo/bar" ); action = "diddly"; id = "dee"; RequestAssert.MessageHasUri(request, expectedUri: "http://localhost:1234/diddly/dee" ); }
public void AbsoluteUri_NoBaseUri_UsesRequestUri() { RequestAssert.MessageHasUri(AbsoluteRequest, expectedUri: AbsoluteRequest.Uri ); }