コード例 #1
0
        public void operations_without_any_member_do_not_get_a_codec_assigned()
        {
            given_filter();
            given_operations();
            given_request_header_content_type(MediaType.ApplicationOctetStream);
            given_registration_codec <ApplicationOctetStreamCodec>();
            given_request_entity_body(new byte[] { 0 });

            when_filtering_operations();

            FilteredOperations.First(x => x.Name == "Get").GetRequestCodec().ShouldBeNull();
        }
コード例 #2
0
        public void the_content_type_is_set_to_application_octet_stream()
        {
            given_filter();
            given_operations();
            given_request_header_content_type((string)null);
            given_registration_codec <ApplicationOctetStreamCodec>();
            given_request_entity_body(new byte[] { 0 });

            when_filtering_operations();

            var selectedCodec = FilteredOperations.First(x => x.Name == "PostForStream");

            selectedCodec.GetRequestCodec().CodecRegistration.MediaType.Matches(MediaType.ApplicationOctetStream)
            .ShouldBeTrue();
        }
コード例 #3
0
        public void operations_with_partially_filled_members_still_get_codec_assigned()
        {
            given_filter();
            given_operations();
            given_request_header_content_type(MediaType.ApplicationXWwwFormUrlencoded);

            given_registration_codec <ApplicationXWwwFormUrlencodedKeyedValuesCodec>();
            given_request_entity_body("firstname=Frodo");

            given_operation_property(x => x.Name == "GetFrodo", "lastname", "baggins");

            when_filtering_operations();

            FilteredOperations.First(x => x.Name == "GetFrodo").GetRequestCodec()
            .ShouldNotBeNull()
            .CodecRegistration.CodecType
            .ShouldBe <ApplicationXWwwFormUrlencodedKeyedValuesCodec>();
        }
コード例 #4
0
        public void the_content_type_is_set_to_application_octet_stream()
        {
            given_filter();
            given_operations();
            given_request_header_content_type((string)null);
            given_registration_codec <ApplicationOctetStreamCodec>();
            given_request_httpmethod("POST");
            given_request_entity_body(new byte[] { 0 });
            Request.Entity.ContentLength = null;
            Request.Headers.Add("transfer-encoding", "chunked");

            when_filtering_operations();

            var selectedCodec = FilteredOperations.First(x => x.Name == "PostForStream");

            selectedCodec.GetRequestCodec().CodecRegistration.MediaType.Matches(MediaType.ApplicationOctetStream)
            .ShouldBeTrue();
        }
コード例 #5
0
 void codec_is_not_assigned(string methodName)
 {
     FilteredOperations.First(x => x.Name == methodName).GetRequestCodec().ShouldBeNull();
 }