public void Given_request_contains_expected_header_when_matching_with_header_name_only_should_match()
        {
            HttpRequestMessage request = GetRequestWithHeaders();

            _sut = new HttpHeadersMatcher("Cache-Control");

            // Act & assert
            _sut.IsMatch(new MockHttpRequestContext(request)).Should().BeTrue();
        }
        public void Given_request_contains_expected_header_with_multiple_values_when_matching_with_wildcard_should_match(string value)
        {
            HttpRequestMessage request = GetRequestWithHeaders();

            _sut = new HttpHeadersMatcher("Cache-Control", value, true);

            // Act & assert
            _sut.IsMatch(new MockHttpRequestContext(request)).Should().BeTrue();
        }
        public void Given_request_contains_expected_header_with_multiple_values_when_matching_for_single_value_should_match()
        {
            HttpRequestMessage request = GetRequestWithHeaders();

            _sut = new HttpHeadersMatcher("Cache-Control", "must-revalidate");

            // Act & assert
            _sut.IsMatch(new MockHttpRequestContext(request)).Should().BeTrue();
        }
        public void Given_request_contains_expected_header_with_multiple_values_when_matching_for_all_values_should_match_irregardless_of_order(params string[] values)
        {
            HttpRequestMessage request = GetRequestWithHeaders();

            _sut = new HttpHeadersMatcher("Cache-Control", values);

            // Act & assert
            _sut.IsMatch(new MockHttpRequestContext(request)).Should().BeTrue();
        }
        public void Given_request_contains_expected_headers_when_matching_should_match()
        {
            DateTimeOffset     lastModified = DateTimeOffset.UtcNow;
            HttpRequestMessage request      = GetRequestWithHeaders(lastModified);

            _sut = new HttpHeadersMatcher(new Dictionary <string, IEnumerable <string> >
            {
                { "Cache-Control", new [] { "must-revalidate", "public", "max-age=31536000" } },
                { "Accept", new [] { "application/json" } },
                { "Last-Modified", new [] { lastModified.ToString("R", CultureInfo.InvariantCulture) } },
                { "Content-Length", new [] { "123" } }
            });

            // Act & assert
            _sut.IsMatch(new MockHttpRequestContext(request)).Should().BeTrue();
        }