public void a_url_with_extra_query_string_parameters_will_match() { var template = new OpenRasta.UriTemplate("/test?q={searchTerm}&p={pageNumber}&s={pageSize}"); OpenRasta.UriTemplateMatch match = template.Match(new Uri("http://localhost/"), new Uri("http://localhost/test?q=test&p=1&s=10&contentType=json")); match.ShouldNotBeNull(); }
public void a_url_not_matching_a_literal_query_string_will_not_match() { var table = new OpenRasta.UriTemplate("/test?query=literal"); OpenRasta.UriTemplateMatch match = table.Match(new Uri("http://localhost"), new Uri("http://localhost/test?query=notliteral")); match.ShouldBeNull(); }
public void a_url_matching_three_query_string_parameters_will_match() { var table = new OpenRasta.UriTemplate("/test?q={searchTerm}&p={pageNumber}&s={pageSize}"); OpenRasta.UriTemplateMatch match = table.Match(new Uri("http://localhost"), new Uri("http://localhost/test?q=&p=1&s=10")); match.ShouldNotBeNull(); match.BoundQueryParameters["searchTerm"].ShouldBe(string.Empty); match.BoundQueryParameters["pageNumber"].ShouldBe("1"); match.BoundQueryParameters["pageSize"].ShouldBe("10"); }
public void a_url_matching_result_in_the_query_value_variable_being_set() { var table = new OpenRasta.UriTemplate("/test?query={queryValue}"); OpenRasta.UriTemplateMatch match = table.Match(new Uri("http://localhost"), new Uri("http://localhost/test?query=search")); match.ShouldNotBeNull(); match.BoundQueryParameters["queryValue"].ShouldBe("search"); }
void GivenAMatching(string baseUri, string template, string candidate) { ThenTheMatch = new OpenRasta.UriTemplate(template).Match(baseUri.ToUri(), candidate.ToUri()); }