Match() публичный Метод

public Match ( Uri baseAddress, Uri candidate ) : UriTemplateMatch
baseAddress System.Uri
candidate System.Uri
Результат UriTemplateMatch
Пример #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();
        }
Пример #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_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);
        }
Пример #5
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");
        }
Пример #6
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_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_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 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 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 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();
 }
Пример #14
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();
        }
 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();
 }