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();
        }
        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();
        }
        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>();
        }
        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();
        }
 void codec_is_not_assigned(string methodName)
 {
     FilteredOperations.First(x => x.Name == methodName).GetRequestCodec().ShouldBeNull();
 }