public void a_codec_that_is_not_registered_for_all_resource_types_is_not_selected()
        {
            GivenACodec <CustomerCodec, Customer>("application/xml");

            WhenFindingCodec("application/xml", typeof(Customer), typeof(Frodo));

            ThenTheResult.ShouldBeNull();
        }
        public void a_codec_for_a_parent_resource_type_with_strict_marker_is_not_found()
        {
            GivenACodec <CustomerCodec, Strictly <object> >("application/xml");

            WhenFindingCodec("application/xml", typeof(Customer));

            ThenTheResult.ShouldBeNull();
        }
        public void a_codec_for_the_exact_resource_type_is_found()
        {
            GivenACodec <CustomerCodec, Strictly <Customer> >("application/xml");

            WhenFindingCodec("application/xml", typeof(Customer));

            ThenTheResult.ShouldNotBeNull();
            ThenTheResult.CodecType.ShouldBe(typeof(CustomerCodec));
        }
        public void an_item_with_a_wildcard_media_type_matches_any_media_type()
        {
            GivenMediaType("*/*", "wildcard");

            WhenMatching("text/plain");

            ThenTheResult.ShouldContain("wildcard");
            ThenTheResult.Count().ShouldBe(1);
        }
        public void an_ireceivedfile_object_is_generated()
        {
            given_context();
            given_request_entity_stream();

            when_decoding();

            ThenTheResult
            .ShouldNotBeNull();
        }
Ejemplo n.º 6
0
        public async Task an_ifile_object_is_generated()
        {
            given_context();
            given_request_entity_stream();

            await when_decoding();

            ThenTheResult
            .ShouldNotBeNull();
        }
        public void registering_the_same_media_type_and_associated_value_adds_it_only_once()
        {
            GivenMediaType("text/plain", "text1");
            GivenMediaType("text/plain", "text1");

            WhenMatching("text/plain");

            ThenTheResult.Count.ShouldBe(1);
            ThenTheResult.ShouldContain("text1");
        }
        public void the_values_are_returned()
        {
            given_context();
            given_request_stream("Customer.Something=John&Customer.SomethingElse=Doe");

            when_decoding <Dictionary <string, string[]> >();

            ThenTheResult
            .ShouldContain("Customer.Something", new[] { "John" })
            .ShouldContain("Customer.SomethingElse", new[] { "Doe" });
        }
        public void registering_two_media_types_with_different_values_is_supported()
        {
            GivenMediaType("text/plain", "text1");
            GivenMediaType("text/plain", "text2");

            WhenMatching("text/plain");

            ThenTheResult.Count.ShouldBe(2);
            ThenTheResult.ShouldContain("text1");
            ThenTheResult.ShouldContain("text2");
        }
        public void matching_on_wildcard_returns_all_results()
        {
            GivenMediaType("application/xml", "xml");
            GivenMediaType("application/xhtml+xml", "xhtml");

            WhenMatching("*/*");

            ThenTheResult.Count.ShouldBe(2);
            ThenTheResult.ShouldContain("xhtml");
            ThenTheResult.ShouldContain("xml");
        }
        public void registering_a_specific_mediatype_and_matching_on_that_mediatype_returns_one_result()
        {
            GivenMediaType("application/xml", "xml");
            GivenMediaType("text/plain", "text");

            WhenMatching("application/xml");

            ThenTheResult.ShouldContain("xml");
            ThenTheResult
            .Count.ShouldBe(1);
        }
        public void registering_a_specific_media_type_and_matching_on_sub_type_wildcard_returns_two_results()
        {
            GivenMediaType("application/xml", "xml");
            GivenMediaType("application/xhtml+xml", "xhtml");
            GivenMediaType("text/plain", "text");

            WhenMatching("application/*");

            ThenTheResult.Count.ShouldBe(2);
            ThenTheResult.ShouldContain("xhtml");
            ThenTheResult.ShouldContain("xml");
        }