Пример #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}");
        }