本文整理汇总了C#中WebHeaderCollection.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# WebHeaderCollection.ToString方法的具体用法?C# WebHeaderCollection.ToString怎么用?C# WebHeaderCollection.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebHeaderCollection
的用法示例。
在下文中一共展示了WebHeaderCollection.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultPropertyValues_ReturnEmptyAfterConstruction_Success
public void DefaultPropertyValues_ReturnEmptyAfterConstruction_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
Assert.Equal(0, w.AllKeys.Length);
Assert.Equal(0, w.Count);
Assert.Equal("\r\n", w.ToString());
Assert.Empty(w);
}
示例2: ToString_Success
public void ToString_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
w.Add("Accept", "text/plain");
w.Add("Content-Length", "123");
Assert.Equal(
"Accept: text/plain\r\nContent-Length: 123\r\n\r\n",
w.ToString());
}
示例3: ToString_NotEmpty_Success
public void ToString_NotEmpty_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
w["Accept"] = "text/plain";
w["Content-Length"] = "123";
Assert.Equal(
"Accept: text/plain\r\nContent-Length: 123\r\n\r\n",
w.ToString());
}
示例4: ToString_SingleHeaderWithEmptyValue_Success
public void ToString_SingleHeaderWithEmptyValue_Success(string value)
{
WebHeaderCollection w = new WebHeaderCollection();
w["name"] = value;
Assert.Equal("name: \r\n\r\n", w.ToString());
}
示例5: ToString_Empty_Success
public void ToString_Empty_Success()
{
WebHeaderCollection w = new WebHeaderCollection();
Assert.Equal("\r\n", w.ToString());
}
示例6: TestWebHeaderCollectionToString
public void TestWebHeaderCollectionToString()
{
WebHeaderCollection whc = new WebHeaderCollection();
whc.Add("test", "entry");
whc.Add("more:junk");
AssertEquals("ToString()","test: entry\r\nmore: junk\r\n",
whc.ToString());
}