protected void when_entity_is_read() { when_filtering_operations(); FilteredOperations.ShouldHaveCountOf(1); ResultOperation = FilteredOperations.Single(); }
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.ShouldHaveCountOf(0); }
public void only_operations_already_ready_for_invocation_get_returned() { given_request_entity_is_zero(); given_filter(); given_operations(); when_filtering_operations(); FilteredOperations.ShouldHaveCountOf(2); then_operation_should_be_selected("Get"); then_operation_should_be_selected("GetWithOptionalValue"); }
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.ShouldHaveCountOf(0); Errors.Errors.Count.ShouldNotBe(0); }
public void an_operation_having_all_parameters_is_selected() { given_filter(); given_operations(); given_pipeline_uriparams(new NameValueCollection { { "index", "42" }, { "content", "value" } }); when_filtering_operations(); FilteredOperations.ShouldHaveCountOf(1).First().Name.ShouldBe("Post"); Errors.Errors.Count.ShouldBe(0); }
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.ShouldHaveCountOf(2); FilteredOperations.Count(x => x.Name == "Post").ShouldBe(1); FilteredOperations.Count(x => x.Name == "PostForRouteName").ShouldBe(1); }
public void the_one_without_a_codec_is_not_selected() { given_filter(); given_operations(); given_operation_has_codec_match <ApplicationOctetStreamCodec>("PostName", MediaType.Xml, 1.0f); when_filtering_operations(); FilteredOperations .ShouldHaveCountOf(1) .First().GetRequestCodec().CodecRegistration.CodecType .ShouldBe <ApplicationOctetStreamCodec>(); }
public void the_one_with_the_highest_score_is_selected() { given_filter(); given_operations(); given_operation_has_codec_match <ApplicationOctetStreamCodec>("PostName", MediaType.Xml, 1.0f); given_operation_has_codec_match <ApplicationXWwwFormUrlencodedKeyedValuesCodec>("PostAddress", MediaType.Xml, 2.0f); when_filtering_operations(); FilteredOperations .ShouldHaveCountOf(1) .First().GetRequestCodec().CodecRegistration.CodecType .ShouldBe <ApplicationXWwwFormUrlencodedKeyedValuesCodec>(); }
public void methods_with_the_attribute_are_included() { given_pipeline_selectedHandler <Handler>(); given_filter(); given_request_uriName("RouteName"); given_request_httpmethod("GET"); given_operations(); when_filtering_operations(); FilteredOperations.ShouldHaveCountOf(2); FilteredOperations.SingleOrDefault(x => x.Name == "GetForRouteName") .ShouldNotBeNull(); FilteredOperations.SingleOrDefault(x => x.Name == "PostForRouteName") .ShouldNotBeNull(); }