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 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");
        }