Пример #1
0
            public void operations_not_having_the_correct_parameter_is_excluded()
            {
                given_filter();
                given_operations();
                given_pipeline_uriparams(new NameValueCollection {
                    { "unknown", "value" }, { "content", "value" }
                });

                when_filtering_operations();

                FilteredOperations.Count().ShouldBe(0);
            }
Пример #2
0
            public void operations_with_the_wrong_parameter_type_are_not_selected()
            {
                given_filter();
                given_operations();
                given_pipeline_uriparams(new NameValueCollection {
                    { "index", "notanumber" }, { "content", "value" }
                });

                when_filtering_operations();

                FilteredOperations.Count().ShouldBe(0);
                Errors.Errors.Count.ShouldNotBe(0);
            }
        public void methods_with_the_attribute_are_removed()
        {
            given_pipeline_selectedHandler <Handler>();
            given_filter();
            given_request_httpmethod("GET");
            given_operations();

            when_filtering_operations();

            FilteredOperations.Count().ShouldBe(3);
            FilteredOperations.SingleOrDefault(x => x.Name == "GetForRouteName").ShouldBeNull();
            FilteredOperations.SingleOrDefault(x => x.Name == "PostForRouteName").ShouldBeNull();
        }
        public void only_operations_already_ready_for_invocation_get_returned_for_TRACE_requests()
        {
            given_request_httpmethod("TRACE");
            given_filter();
            given_operations();

            when_filtering_operations();

            FilteredOperations.Count().ShouldBe(3);

            then_operation_should_be_selected("Trace");
            codec_is_not_assigned("Trace");
        }
        public void only_operations_already_ready_for_invocation_get_returned_for_no_content_length()
        {
            given_filter();
            given_operations();

            when_filtering_operations();

            FilteredOperations.Count().ShouldBe(3);

            then_operation_should_be_selected("Get");
            codec_is_not_assigned("Get");
            then_operation_should_be_selected("GetWithOptionalValue");
        }
        public void the_methods_are_matched_by_name_starting_with_http_method()
        {
            given_pipeline_selectedHandler <Handler>();
            given_filter();
            given_request_httpmethod("POST");
            given_operations();

            when_filtering_operations();

            FilteredOperations.Count().ShouldBe(2);

            FilteredOperations.Count(x => x.Name == "Post").ShouldBe(1);
            FilteredOperations.Count(x => x.Name == "PostForRouteName").ShouldBe(1);
        }
Пример #7
0
            public void operations_only_selected_when_writeable_properties()
            {
                given_operations();
                given_uri_registration(new object(), "/");
                given_first_resource_selected();
                given_pipeline_uriparams(new NameValueCollection {
                    { "id", "3" }
                });
                given_filter();

                when_filtering_operations();

                FilteredOperations.Count().ShouldBe(1);
            }
        public void only_operations_already_ready_for_invocation_get_returned()
        {
            given_request_entity_is_zero();
            given_filter();
            given_operations();

            when_filtering_operations();

            FilteredOperations.Count().ShouldBe(2);

            then_operation_should_be_selected("Get");
            codec_is_not_assigned("Get");
            then_operation_should_be_selected("GetWithOptionalValue");
        }
Пример #9
0
        public void methods_matching_convention_are_included()
        {
            given_pipeline_selectedHandler <ConventionalHandler>();
            given_uri_registration(new object(), "/", "RouteName");
            given_request_httpmethod("GET");
            given_operations();
            given_first_resource_selected();

            given_filter();

            when_filtering_operations();

            FilteredOperations.Count().ShouldBe(1);

            FilteredOperations.SingleOrDefault(x => x.Name == "GetRouteName").ShouldNotBeNull();
        }
Пример #10
0
        public void methods_with_the_attribute_are_included()
        {
            given_pipeline_selectedHandler <Handler>();
            given_uri_registration(new object(), "/", "RouteName");
            given_request_httpmethod("GET");
            given_operations();
            given_first_resource_selected();
            given_filter();

            when_filtering_operations();

            FilteredOperations.Count().ShouldBe(2);

            FilteredOperations.SingleOrDefault(x => x.Name == "GetForRouteName").ShouldNotBeNull();
            FilteredOperations.SingleOrDefault(x => x.Name == "PostForRouteName").ShouldNotBeNull();
        }