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


C# MockHeaders.ContainsParsedValue方法代码示例

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


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

示例1: ContainsParsedValue_CallFromEmptyHeaderStore_ReturnsFalse

        public void ContainsParsedValue_CallFromEmptyHeaderStore_ReturnsFalse()
        {
            MockHeaders headers = new MockHeaders();

            // This will create a header entry with no value.
            headers.Add(knownHeader, string.Empty);

            Assert.False(headers.Contains(knownHeader), "Expected known header to be in the store.");

            // This will just return fals and not touch the header.
            Assert.False(headers.ContainsParsedValue(knownHeader, "x"),
                "Expected 'ContainsParsedValue' to return false.");
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:13,代码来源:HttpHeadersTest.cs

示例2: MockHeaders

        public void ContainsParsedValue_AddOneValueToKnownHeaderAndCompareWithValueThatDiffersInCase_CustomComparerUsedForComparison()
        {
            MockHeaders headers = new MockHeaders();
            headers.AddParsedValue(knownHeader, "value");

            // Our custom comparer (MockComparer) does case-insensitive value comparison. Verify that our custom
            // comparer is used to compare the header value.
            Assert.True(headers.ContainsParsedValue(knownHeader, "VALUE"));
            Assert.Equal(1, headers.Parser.MockComparer.EqualsCount);

            headers.Clear();
            headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue);
            Assert.False(headers.ContainsParsedValue(knownHeader, invalidHeaderValue));
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:14,代码来源:HttpHeadersTest.cs

示例3: ContainsParsedValue_ContainsParsedValueForExistingHeaderWithAvailableValue_ReturnsTrue

        public void ContainsParsedValue_ContainsParsedValueForExistingHeaderWithAvailableValue_ReturnsTrue()
        {
            MockHeaders headers = new MockHeaders();
            headers.TryAddWithoutValidation(knownHeader, rawPrefix + "1");
            headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2");
            headers.TryAddWithoutValidation(knownHeader, rawPrefix + "3");
            headers.TryAddWithoutValidation(knownHeader, rawPrefix + "4");

            Assert.Equal(0, headers.Parser.TryParseValueCallCount);

            Assert.True(headers.ContainsParsedValue(knownHeader, parsedPrefix + "3"));

            // ContainsParsedValue() must trigger raw value parsing for the header it was asked for.
            Assert.Equal(4, headers.Parser.TryParseValueCallCount);
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:15,代码来源:HttpHeadersTest.cs

示例4: ContainsParsedValue_ContainsParsedValueForExistingHeaderButNonAvailableValue_ReturnsFalse

        public void ContainsParsedValue_ContainsParsedValueForExistingHeaderButNonAvailableValue_ReturnsFalse()
        {
            MockHeaders headers = new MockHeaders();
            headers.TryAddWithoutValidation(knownHeader, rawPrefix);

            Assert.Equal(0, headers.Parser.TryParseValueCallCount);

            Assert.False(headers.ContainsParsedValue(knownHeader, "custom1"));

            // ContainsParsedValue() must trigger raw value parsing for the header it was asked for.
            Assert.Equal(1, headers.Parser.TryParseValueCallCount);
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:12,代码来源:HttpHeadersTest.cs

示例5: ContainsParsedValue_ContainsParsedValueForNonExistingHeaderValue_ReturnsFalse

        public void ContainsParsedValue_ContainsParsedValueForNonExistingHeaderValue_ReturnsFalse()
        {
            MockHeaders headers = new MockHeaders();
            headers.AddParsedValue(knownHeader, "value1");
            headers.AddParsedValue(knownHeader, "value2");

            // After adding two values to header 'knownHeader' we ask for a non-existing value.
            Assert.False(headers.ContainsParsedValue(knownHeader, "doesntexist"));
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:9,代码来源:HttpHeadersTest.cs

示例6: ContainsParsedValue_ContainsParsedValueForNonExistingHeader_ReturnsFalse

        public void ContainsParsedValue_ContainsParsedValueForNonExistingHeader_ReturnsFalse()
        {
            MockHeaders headers = new MockHeaders();
            headers.TryAddWithoutValidation(knownHeader, rawPrefix);

            Assert.Equal(0, headers.Parser.TryParseValueCallCount);

            Assert.False(headers.ContainsParsedValue(customHeader, "custom1"));

            // ContainsParsedValue() must not trigger raw value parsing for headers other than the requested one.
            // In this case we expect ContainsParsedValue(customeHeader) not to trigger raw value parsing for
            // 'knownHeader'.
            Assert.Equal(0, headers.Parser.TryParseValueCallCount);
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:14,代码来源:HttpHeadersTest.cs

示例7: ContainsParsedValue_ContainsParsedValueFromUninitializedHeaderStore_ReturnsFalse

 public void ContainsParsedValue_ContainsParsedValueFromUninitializedHeaderStore_ReturnsFalse()
 {
     MockHeaders headers = new MockHeaders();
     Assert.False(headers.ContainsParsedValue(customHeader, "custom1"));
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:5,代码来源:HttpHeadersTest.cs


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