本文整理汇总了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.");
}
示例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));
}
示例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);
}
示例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);
}
示例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"));
}
示例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);
}
示例7: ContainsParsedValue_ContainsParsedValueFromUninitializedHeaderStore_ReturnsFalse
public void ContainsParsedValue_ContainsParsedValueFromUninitializedHeaderStore_ReturnsFalse()
{
MockHeaders headers = new MockHeaders();
Assert.False(headers.ContainsParsedValue(customHeader, "custom1"));
}