Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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");
        }
Exemplo n.º 4
0
        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());
 }
Exemplo n.º 6
0
 void GivenAMatching(string baseUri, string template, string candidate)
 {
     ThenTheMatch = new OpenRasta.UriTemplate(template).Match(baseUri.ToUri(), candidate.ToUri());
 }