예제 #1
0
        public void it_should_build_uri_regex_properly()
        {
            var segments = new UriTemplateBuilder.QueryStringList(null, true);
            segments.Add("id=[^&]+", new FromQueryStringAttribute("&id={?id}"), typeof(CrudController).GetMethod("Update").GetParameters()[0]);
            segments.Add("person=[^&]+", new FromQueryStringAttribute("&person={?person}"), typeof(CrudController).GetMethod("Update").GetParameters()[1]);

            var result = segments.ToString();

            result.Should().Be("([?&](id|person)=[^&]*){0,}");
        }
예제 #2
0
        public void it_should_build_uri_template_properly()
        {
            var segments = new UriTemplateBuilder.QueryStringList(null, false);
            segments.Add("id={?id}", new FromQueryStringAttribute("&id={?id}"), typeof(CrudController).GetMethod("Update").GetParameters()[0]);
            segments.Add("person={?person}", new FromQueryStringAttribute("&person={?person}"), typeof(CrudController).GetMethod("Update").GetParameters()[1]);

            var result = segments.ToString();

            result.Should().Be("?id={id}{&person}");
        }
예제 #3
0
        public void it_should_build_uri_regex_properly()
        {
            var segments = new UriTemplateBuilder.QueryStringList(null, true);

            segments.Add("id=[^&]+", new FromQueryStringAttribute("&id={?id}"), typeof(CrudController).GetMethod("Update").GetParameters()[0]);
            segments.Add("person=[^&]+", new FromQueryStringAttribute("&person={?person}"), typeof(CrudController).GetMethod("Update").GetParameters()[1]);

            var result = segments.ToString();

            result.Should().Be("([?&](id|person)=[^&]*){0,}");
        }
예제 #4
0
        public void it_should_build_uri_template_properly()
        {
            var segments = new UriTemplateBuilder.QueryStringList(null, false);

            segments.Add("id={?id}", new FromQueryStringAttribute("&id={?id}"), typeof(CrudController).GetMethod("Update").GetParameters()[0]);
            segments.Add("person={?person}", new FromQueryStringAttribute("&person={?person}"), typeof(CrudController).GetMethod("Update").GetParameters()[1]);

            var result = segments.ToString();

            result.Should().Be("?id={id}{&person}");
        }