예제 #1
0
        public void multiple_query_parameters_are_processed()
        {
            var template = new OpenRasta.UriTemplate("/test?query1={test}&query2={test2}");

            template.QueryValueVariableNames.Contains("test").ShouldBeTrue();
            template.QueryValueVariableNames.Contains("test2").ShouldBeTrue();
        }
예제 #2
0
        public void a_url_matching_multiple_query_parameters_should_match()
        {
            var template = new OpenRasta.UriTemplate("/test?query1={test}&query2={test2}");
            var match    = template.Match(new Uri("http://localhost"), new Uri("http://localhost/test?query1=test1&query2=test2"));

            match.ShouldNotBeNull();
        }
예제 #3
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();
        }
예제 #4
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();
        }
예제 #5
0
        public void more_than_two_query_parameters_with_similar_names_are_processed()
        {
            var template = new OpenRasta.UriTemplate("/test?query1={test}&query2={test2}&query3={test3}");

            template.QueryValueVariableNames.Contains("test").ShouldBeTrue();
            template.QueryValueVariableNames.Contains("test2").ShouldBeTrue();
            template.QueryValueVariableNames.Contains("test3").ShouldBeTrue();
        }
예제 #6
0
        public void a_parameter_different_by_last_letter_to_query_parameters_should_not_match()
        {
            var template = new OpenRasta.UriTemplate("/test?query1={test}&query2={test2}");
            var match    = template.Match(new Uri("http://localhost"), new Uri("http://localhost/test?query1=test1&query3=test2"));

            match.ShouldNotBeNull();
            match.BoundVariables.Count.ShouldBe(1);
            match.QueryParameters.Count.ShouldBe(2);
        }
예제 #7
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");
        }
예제 #8
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");
        }
 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.QueryStringVariables["searchTerm"].ShouldBe(string.Empty);
    match.QueryStringVariables["pageNumber"].ShouldBe("1");
    match.QueryStringVariables["pageSize"].ShouldBe("10");  
 }  
 public void more_than_two_query_parameters_with_similar_names_are_processed()  
 {  
    var template = new OpenRasta.UriTemplate("/test?query1={test}&query2={test2}&query3={test3}");  
    template.QueryStringVariableNames.Contains("test").ShouldBeTrue();  
    template.QueryStringVariableNames.Contains("test2").ShouldBeTrue();  
    template.QueryStringVariableNames.Contains("test3").ShouldBeTrue();  
 }  
 public void a_parameter_different_by_last_letter_to_query_parameters_should_not_match()  
 {  
    var template = new OpenRasta.UriTemplate("/test?query1={test}&query2={test2}");
    var match = template.Match(new Uri("http://localhost"), new Uri("http://localhost/test?query1=test1&query3=test2"));
    match.ShouldNotBeNull();
    match.PathSegmentVariables.Count.ShouldBe(0);
     match.QueryStringVariables.Count.ShouldBe(1);
    match.QueryParameters.Count.ShouldBe(2);
 }  
 public void a_url_matching_multiple_query_parameters_should_match()  
 {  
    var template = new OpenRasta.UriTemplate("/test?query1={test}&query2={test2}");  
    var match = template.Match(new Uri("http://localhost"), new Uri("http://localhost/test?query1=test1&query2=test2"));  
    match.ShouldNotBeNull();  
 }  
 public void multiple_query_parameters_are_processed()
 {
     var template = new OpenRasta.UriTemplate("/test?query1={test}&query2={test2}");
     template.QueryStringVariableNames.Contains("test").ShouldBeTrue();
     template.QueryStringVariableNames.Contains("test2").ShouldBeTrue();
 }
 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_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.QueryStringVariables["queryValue"].ShouldBe("search");
        }
 public void a_query_parameter_with_no_variable_is_ignored()
 {
     var template = new OpenRasta.UriTemplate("/test?query=3");
     template.QueryStringVariableNames.Count.ShouldBe(0);
 }
 public void a_url_different_by_last_letter_to_query_parameters_should_not_match()
 {
     var template = new OpenRasta.UriTemplate("/test?query1={test}&query2={test2}");
        var match = template.Match(new Uri("http://localhost"), new Uri("http://localhost/test?query1=test1&query3=test2"));
        match.ShouldBeNull();
 }
 public void GivenTwoTemplates(string template1, string template2)
 {
     TheResult = new OpenRasta.UriTemplate(template1).IsEquivalentTo(new OpenRasta.UriTemplate(template2));
 }
 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();  
 }  
예제 #20
0
        public void matching_urls_with_different_host_names_returns_no_match()
        {
            var table = new OpenRasta.UriTemplate("/temp");

            table.Match(new Uri("http://localhost"), new Uri("http://notlocalhost/temp")).ShouldBeNull();
        }
예제 #21
0
        public void a_query_parameter_with_no_variable_is_ignored()
        {
            var template = new OpenRasta.UriTemplate("/test?query=3");

            template.QueryValueVariableNames.Count.ShouldBe(0);
        }
 public void the_query_parameters_are_exposed()
 {
     var table = new OpenRasta.UriTemplate("/test?query={queryValue}");
     table.QueryStringVariableNames.Contains("queryValue").ShouldBeTrue();
 }
예제 #23
0
        public void the_query_parameters_are_exposed()
        {
            var table = new OpenRasta.UriTemplate("/test?query={queryValue}");

            table.QueryValueVariableNames.Contains("queryValue").ShouldBeTrue();
        }
        public void a_template_isnt_equivalent_to_a_null_reference()
        {
            TheResult = new OpenRasta.UriTemplate("weather/{state}/{city}").IsEquivalentTo(null);

            TheResult.ShouldBeFalse();
        }
 public void matching_urls_with_different_host_names_returns_no_match()
 {
     var table = new OpenRasta.UriTemplate("/temp");
     table.Match(new Uri("http://localhost"), new Uri("http://notlocalhost/temp")).ShouldBeNull();
 }