当前位置: 首页>>代码示例>>C#>>正文


C# RequestHeaders.ShouldHaveCount方法代码示例

本文整理汇总了C#中RequestHeaders.ShouldHaveCount方法的典型用法代码示例。如果您正苦于以下问题:C# RequestHeaders.ShouldHaveCount方法的具体用法?C# RequestHeaders.ShouldHaveCount怎么用?C# RequestHeaders.ShouldHaveCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RequestHeaders的用法示例。


在下文中一共展示了RequestHeaders.ShouldHaveCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_return_all_accept_headers_when_multiple_are_available

        public void Should_return_all_accept_headers_when_multiple_are_available()
        {
            // Given
            var rawHeaders = 
                new Dictionary<string, IEnumerable<string>>
                {
                    { "Accept", new[] { "text/plain", "text/ninja" } }
                };

            // When
            var headers = new RequestHeaders(rawHeaders).Accept.ToList();

            // Then
            headers.ShouldHaveCount(2);
            headers[0].Item1.ShouldEqual("text/plain");
            headers[1].Item1.ShouldEqual("text/ninja");
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:17,代码来源:RequestHeadersFixture.cs

示例2: Should_default_accept_language_header_values_to_quality_one_if_not_explicitly_defined

        public void Should_default_accept_language_header_values_to_quality_one_if_not_explicitly_defined()
        {
            // Given
            var values = new[] { "en-US" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept-Language", values } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptLanguage.ToList();

            // Then
            headers.ShouldHaveCount(1);
            headers[0].Item1.ShouldEqual("en-US");
            headers[0].Item2.ShouldEqual(1m);
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs

示例3: Should_parse_accept_language_header_value_quality_when_available

        public void Should_parse_accept_language_header_value_quality_when_available()
        {
            // Given
            var values = new[] { "en-US;q=0.3" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept-Language", values } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptLanguage.ToList();

            // Then
            headers.ShouldHaveCount(1);
            headers[0].Item1.ShouldEqual("en-US");
            headers[0].Item2.ShouldEqual(0.3m);
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs

示例4: Should_parse_accept_language_header_values_when_containing_multiple_values

        public void Should_parse_accept_language_header_values_when_containing_multiple_values()
        {
            // Given
            var values = new[] { "en-US, sv-SE" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept-Language", values } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptLanguage.ToList();

            // Then
            headers.ShouldHaveCount(2);
            headers[0].Item1.ShouldEqual("en-US");
            headers[1].Item1.ShouldEqual("sv-SE");
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs

示例5: Should_return_accept_language_headers_when_available

        public void Should_return_accept_language_headers_when_available()
        {
            // Given
            var expectedValues = new[] { "en-US", "sv-SE" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept-Language", expectedValues } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptLanguage.ToList();

            // Then
            headers.ShouldHaveCount(2);
            headers[0].Item1.ShouldEqual("en-US");
            headers[1].Item1.ShouldEqual("sv-SE");
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs

示例6: Should_not_strip_additional_accept_header_parameters

        public void Should_not_strip_additional_accept_header_parameters()
        {
            // Given
            var values = new[] { "text/plain, text/ninja;q=0.3;a=1;b=2" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept", values } };

            // When
            var headers = new RequestHeaders(rawHeaders).Accept.ToList();

            // Then
            headers.ShouldHaveCount(2);
            headers.ShouldHave(t => t.Item1 == "text/plain" && t.Item2 == 1.0m);
            headers.ShouldHave(t => t.Item1 == "text/ninja;a=1;b=2" && t.Item2 == 0.3m);
         }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs

示例7: Should_parse_accept_header_values_when_containing_multiple_values

        public void Should_parse_accept_header_values_when_containing_multiple_values()
        {
            // Given
            var values = new[] { "text/plain, text/ninja" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept", values } };

            // When
            var headers = new RequestHeaders(rawHeaders).Accept.ToList();

            // Then
            headers.ShouldHaveCount(2);
            headers[0].Item1.ShouldEqual("text/plain");
            headers[1].Item1.ShouldEqual("text/ninja");
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs

示例8: Should_ignore_case_of_accept_language_header_name_when_retrieving_values

        public void Should_ignore_case_of_accept_language_header_name_when_retrieving_values(string headerName)
        {
            // Given
            var expectedValues = new[] { "en-US", "sv-SE" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { headerName, expectedValues } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptLanguage.ToList();

            // Then
            headers.ShouldHaveCount(2);
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:12,代码来源:RequestHeadersFixture.cs

示例9: Should_return_accept_encoding_headers_when_available

        public void Should_return_accept_encoding_headers_when_available()
        {
            // Given
            var expectedValues = new[] { "compress", "sdch" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept-Encoding", expectedValues } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptEncoding.ToList();

            // Then
            headers.ShouldHaveCount(2);
            headers[0].ShouldEqual("compress");
            headers[1].ShouldEqual("sdch");
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs

示例10: Should_sort_accept_charset_header_values_decending_based_on_quality

        public void Should_sort_accept_charset_header_values_decending_based_on_quality()
        {
            // Given
            var values = new[] { "utf-8;q=0.3, iso-8859-5, iso-8859-15;q=0.7" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept-Charset", values } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptCharset.ToList();

            // Then
            headers.ShouldHaveCount(3);
            headers[0].Item1.ShouldEqual("iso-8859-5");
            headers[1].Item1.ShouldEqual("iso-8859-15");
            headers[2].Item1.ShouldEqual("utf-8");
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:15,代码来源:RequestHeadersFixture.cs

示例11: Should_ignore_accept_charset_header_values_with_invalid_quality

        public void Should_ignore_accept_charset_header_values_with_invalid_quality()
        {
            // Given
            var values = new[] { "utf-8, iso-8859-5;q=a" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept-Charset", values } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptCharset.ToList();

            // Then
            headers.ShouldHaveCount(2);
            headers.ShouldHave(t => t.Item1 == "utf-8" && t.Item2 == 1.0m);
            headers.ShouldHave(t => t.Item1 == "iso-8859-5" && t.Item2 == 1.0m);
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs

示例12: Should_parse_accept_charset_header_values_when_containing_multiple_values

        public void Should_parse_accept_charset_header_values_when_containing_multiple_values()
        {
            // Given
            var values = new[] { "utf-8, iso-8859-5" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept-Charset", values } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptCharset.ToList();

            // Then
            headers.ShouldHaveCount(2);
            headers[0].Item1.ShouldEqual("utf-8");
            headers[1].Item1.ShouldEqual("iso-8859-5");
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs

示例13: Should_return_accept_charset_headers_when_available

        public void Should_return_accept_charset_headers_when_available()
        {
            // Given
            var expectedValues = new[] { "utf-8", "iso-8859-5" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept-Charset", expectedValues } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptCharset.ToList();

            // Then
            headers.ShouldHaveCount(2);
            headers[0].Item1.ShouldEqual("utf-8");
            headers[1].Item1.ShouldEqual("iso-8859-5");
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs

示例14: Should_sort_accept_header_values_decending_based_on_quality

        public void Should_sort_accept_header_values_decending_based_on_quality()
        {
            // Given
            var values = new[] { "text/plain;q=0.3, text/ninja, text/html;q=0.7" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept", values } };

            // When
            var headers = new RequestHeaders(rawHeaders).Accept.ToList();

            // Then
            headers.ShouldHaveCount(3);
            headers[0].Item1.ShouldEqual("text/ninja");
            headers[1].Item1.ShouldEqual("text/html");
            headers[2].Item1.ShouldEqual("text/plain");
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:15,代码来源:RequestHeadersFixture.cs

示例15: Should_ignore_accept_language_header_values_with_invalid_quality

        public void Should_ignore_accept_language_header_values_with_invalid_quality()
        {
            // Given
            var values = new[] { "en-US, sv-SE;q=a" };
            var rawHeaders = new Dictionary<string, IEnumerable<string>> { { "Accept-Language", values } };

            // When
            var headers = new RequestHeaders(rawHeaders).AcceptLanguage.ToList();

            // Then
            headers.ShouldHaveCount(2);
            headers.ShouldHave(t => t.Item1 == "en-US" && t.Item2 == 1.0m);
            headers.ShouldHave(t => t.Item1 == "sv-SE" && t.Item2 == 1.0m);
        }
开发者ID:Borzoo,项目名称:Nancy,代码行数:14,代码来源:RequestHeadersFixture.cs


注:本文中的RequestHeaders.ShouldHaveCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。