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


C# MockHeaders.RemoveParsedValue方法代码示例

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


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

示例1: MockHeaders

        public void RemoveParsedValue_AddTwoValuesToKnownHeaderAndCompareWithValueThatDiffersInCase_CustomComparerUsedForComparison()
        {
            MockHeaders headers = new MockHeaders();
            headers.AddParsedValue(knownHeader, "differentvalue");
            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.
            // Note that since we added 2 values a different code path than in the previous test is used. In this
            // case we have stored the values as List<string> internally.
            Assert.True(headers.RemoveParsedValue(knownHeader, "VALUE"));
            Assert.Equal(1, headers.GetValues(knownHeader).Count());
            Assert.Equal(2, headers.Parser.MockComparer.EqualsCount);
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:14,代码来源:HttpHeadersTest.cs

示例2: RemoveParsedValue_RemoveFromUninitializedHeaderStore_ReturnsFalse

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

            // If we never add a header value, the whole header (and also the header store) doesn't exist.
            // Make sure we considered this case.
            Assert.False(headers.RemoveParsedValue(knownHeader, "doesntexist"));
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:8,代码来源:HttpHeadersTest.cs

示例3: RemoveParsedValue_RemoveFromNonExistingHeader_ReturnsFalse

        public void RemoveParsedValue_RemoveFromNonExistingHeader_ReturnsFalse()
        {
            MockHeaders headers = new MockHeaders();
            headers.Add(knownHeader, rawPrefix);

            // Header 'non-existing-header' can't be found, so false is returned.
            Assert.False(headers.RemoveParsedValue("non-existing-header", "doesntexist"));
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:8,代码来源:HttpHeadersTest.cs

示例4: RemoveParsedValue_AddTwoValuesAndRemoveSecondOne_FirstValueRemains

        public void RemoveParsedValue_AddTwoValuesAndRemoveSecondOne_FirstValueRemains()
        {
            MockHeaders headers = new MockHeaders();
            headers.Add(knownHeader, rawPrefix + "1");
            headers.Add(knownHeader, rawPrefix + "2");

            // Remove the parsed value (note the original string 'raw2' was "parsed" to 'parsed2')
            Assert.True(headers.RemoveParsedValue(knownHeader, parsedPrefix + "2"));

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

            // Note that when the last value of a header gets removed, the whole header gets removed.
            Assert.Equal(1, headers.Count());
            Assert.Equal(1, headers.First().Value.Count());
            Assert.Equal(parsedPrefix + "1", headers.First().Value.ElementAt(0));

            Assert.Equal(2, headers.Parser.TryParseValueCallCount);
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:18,代码来源:HttpHeadersTest.cs

示例5: RemoveParsedValue_AddTwoValuesAndRemoveThem_NoHeader

        public void RemoveParsedValue_AddTwoValuesAndRemoveThem_NoHeader()
        {
            MockHeaders headers = new MockHeaders();
            headers.Add(knownHeader, rawPrefix + "1");
            headers.Add(knownHeader, rawPrefix + "2");

            // Remove the parsed value (note the original string 'raw1' was "parsed" to 'parsed1')
            Assert.True(headers.RemoveParsedValue(knownHeader, parsedPrefix + "1"));
            Assert.True(headers.RemoveParsedValue(knownHeader, parsedPrefix + "2"));

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

            // Note that when the last value of a header gets removed, the whole header gets removed.
            Assert.Equal(0, headers.Count());

            Assert.Equal(2, headers.Parser.TryParseValueCallCount);
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:17,代码来源:HttpHeadersTest.cs

示例6: RemoveParsedValue_AddInvalidValueAndRemoveValidValue_InvalidValueRemains

        public void RemoveParsedValue_AddInvalidValueAndRemoveValidValue_InvalidValueRemains()
        {
            MockHeaders headers = new MockHeaders();
            headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue);

            // Remove a valid value which is not in the store.
            Assert.False(headers.RemoveParsedValue(knownHeader, parsedPrefix));

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

            // Note that when the last value of a header gets removed, the whole header gets removed.
            Assert.Equal(1, headers.Count());
            Assert.Equal(invalidHeaderValue, headers.GetValues(knownHeader).First());

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

            // Remove the value again: It shouldn't be found in the store.
            Assert.False(headers.RemoveParsedValue(knownHeader, parsedPrefix + "1"));
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:19,代码来源:HttpHeadersTest.cs

示例7: RemoveParsedValue_AddValueAndRemoveIt_NoHeader

        public void RemoveParsedValue_AddValueAndRemoveIt_NoHeader()
        {
            MockHeaders headers = new MockHeaders();
            headers.Add(knownHeader, rawPrefix + "1");

            // Remove the parsed value (note the original string 'raw1' was "parsed" to 'parsed1')
            Assert.True(headers.RemoveParsedValue(knownHeader, parsedPrefix + "1"));

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

            // Note that when the last value of a header gets removed, the whole header gets removed.
            Assert.Equal(0, headers.Count());

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

            // Remove the value again: It shouldn't be found in the store.
            Assert.False(headers.RemoveParsedValue(knownHeader, parsedPrefix + "1"));
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:18,代码来源:HttpHeadersTest.cs


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