本文整理汇总了C#中MockHeaders.GetHeaderStrings方法的典型用法代码示例。如果您正苦于以下问题:C# MockHeaders.GetHeaderStrings方法的具体用法?C# MockHeaders.GetHeaderStrings怎么用?C# MockHeaders.GetHeaderStrings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MockHeaders
的用法示例。
在下文中一共展示了MockHeaders.GetHeaderStrings方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHeaderStrings_SetMultipleHeaders_AllHeaderValuesReturned
public void GetHeaderStrings_SetMultipleHeaders_AllHeaderValuesReturned()
{
MockHeaderParser parser = new MockHeaderParser(true);
MockHeaders headers = new MockHeaders(parser);
// Add header value with invalid newline chars.
headers.Add(knownHeader, rawPrefix + "1");
headers.Add("header2", "value2");
headers.Add("header3", (string)null);
headers.Add("header4", "value41");
headers.Add("header4", "value42");
string[] expectedHeaderNames = { knownHeader, "header2", "header3", "header4" };
string[] expectedHeaderValues = { parsedPrefix + "1", "value2", "", "value41, value42" };
int i = 0;
foreach (var header in headers.GetHeaderStrings())
{
Assert.NotEqual(expectedHeaderNames.Length, i);
Assert.Equal(expectedHeaderNames[i], header.Key);
Assert.Equal(expectedHeaderValues[i], header.Value);
i++;
}
}
示例2: GetHeaderStrings_SetMultipleValuesOnSingleValueHeader_AllHeaderValuesReturned
public void GetHeaderStrings_SetMultipleValuesOnSingleValueHeader_AllHeaderValuesReturned()
{
MockHeaderParser parser = new MockHeaderParser(false);
MockHeaders headers = new MockHeaders(parser);
headers.TryAddWithoutValidation(knownHeader, "value1");
headers.TryAddWithoutValidation(knownHeader, rawPrefix);
foreach (var header in headers.GetHeaderStrings())
{
Assert.Equal(knownHeader, header.Key);
// Note that the added rawPrefix did not get parsed
Assert.Equal("value1, " + rawPrefix, header.Value);
}
}
示例3: GetHeaderStrings_SetValidAndInvalidHeaderValues_AllHeaderValuesReturned
public void GetHeaderStrings_SetValidAndInvalidHeaderValues_AllHeaderValuesReturned()
{
MockHeaderParser parser = new MockHeaderParser("---");
MockHeaders headers = new MockHeaders(parser);
// Add header value with invalid newline chars.
headers.Add(knownHeader, rawPrefix + "1");
headers.TryAddWithoutValidation(knownHeader, "value2,value3");
headers.TryAddWithoutValidation(knownHeader, invalidHeaderValue);
foreach (var header in headers.GetHeaderStrings())
{
Assert.Equal(knownHeader, header.Key);
// Note that raw values don't get parsed but just added to the result.
Assert.Equal("value2,value3---" + invalidHeaderValue + "---" + parsedPrefix + "1", header.Value);
}
}