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


C# WebHeaderCollection.Remove方法代码示例

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


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

示例1: HttpRequestHeader_Add_Remove_Success

        public void HttpRequestHeader_Add_Remove_Success()
        {
            WebHeaderCollection w = new WebHeaderCollection();
            w.Add(HttpRequestHeader.Warning, "Warning1");

            Assert.Equal(1, w.Count);
            Assert.Equal("Warning1", w[HttpRequestHeader.Warning]);
            Assert.Equal("Warning", w.AllKeys[0]);

            w.Remove(HttpRequestHeader.Warning);
            Assert.Equal(0, w.Count);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:12,代码来源:WebHeaderCollectionTest.netstandard17.cs

示例2: Custom_AddThenRemove_Success

 public void Custom_AddThenRemove_Success()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     w.Add("name", "value");
     w.Remove("name");
     Assert.Equal(0, w.Count);
 }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:7,代码来源:WebHeaderCollectionTest.cs

示例3: Custom_RemoveIllegalCharacter_Throws

 public void Custom_RemoveIllegalCharacter_Throws()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     Assert.Throws<ArgumentException>(() => w.Remove("{"));
 }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:5,代码来源:WebHeaderCollectionTest.cs

示例4: Custom_RemoveBlankName_Throws

 public void Custom_RemoveBlankName_Throws()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     Assert.Throws<ArgumentNullException>(() => w.Remove(""));
 }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:5,代码来源:WebHeaderCollectionTest.cs

示例5: Remove_SetTwoThenRemoveOne_Success

 public void Remove_SetTwoThenRemoveOne_Success(string setName, string removeName)
 {
     WebHeaderCollection w = new WebHeaderCollection();
     w[setName] = "value";
     w["foo"] = "bar";
     w.Remove(removeName);
     Assert.Equal(1, w.Count);
     Assert.NotEmpty(w);
     Assert.NotEmpty(w.AllKeys);
     Assert.Equal(new[] { "foo" }, w.AllKeys);
     Assert.Equal("bar", w["foo"]);
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:12,代码来源:WebHeaderCollectionTest.cs

示例6: Remove_SetThenRemove_Success

 public void Remove_SetThenRemove_Success(string setName, string removeName)
 {
     WebHeaderCollection w = new WebHeaderCollection();
     w[setName] = "value";
     w.Remove(removeName);
     Assert.Equal(0, w.Count);
     Assert.Empty(w);
     Assert.Empty(w.AllKeys);
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:9,代码来源:WebHeaderCollectionTest.cs

示例7: Remove_EmptyCollection_Success

 public void Remove_EmptyCollection_Success()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     w.Remove("foo");
     Assert.Equal(0, w.Count);
     Assert.Empty(w);
     Assert.Empty(w.AllKeys);
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:8,代码来源:WebHeaderCollectionTest.cs

示例8: Remove_IllegalCharacter_Throws

 public void Remove_IllegalCharacter_Throws()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     Assert.Throws<ArgumentException>("name", () => w.Remove("{"));
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:5,代码来源:WebHeaderCollectionTest.cs

示例9: Remove_NullOrEmptyName_Throws

 public void Remove_NullOrEmptyName_Throws(string name)
 {
     WebHeaderCollection w = new WebHeaderCollection();
     Assert.Throws<ArgumentNullException>("name", () => w.Remove(name));
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:5,代码来源:WebHeaderCollectionTest.cs

示例10: HttpRequestHeader_Remove_Failure

 public void HttpRequestHeader_Remove_Failure()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     Assert.Throws<ArgumentNullException>(() => w.Remove(null));
 }
开发者ID:dotnet,项目名称:corefx,代码行数:5,代码来源:WebHeaderCollectionTest.netstandard17.cs

示例11: TestWebHeaderCollectionRemove

	public void TestWebHeaderCollectionRemove()
	{
		WebHeaderCollection whc = new WebHeaderCollection();
		whc.Add("some:stuff");
		whc.Remove("some");
		try
		{
			whc.Remove(null);
			Fail("Remove: failed to throw exception for null argument");
		}
		catch (ArgumentNullException)
		{
			// Ok
		}
		try
		{
			whc.Remove("[NotValidHeader?]");
			Fail("Remove: failed to throw exception for invalid header name: '[NotValidHeader?]'");
		}
		catch (ArgumentException)
		{
			// Yep...
		}
		try
		{
			whc.Remove("accept");
			Fail("Remove: failed to throw exception for restricted header 'accept'");
		}
		catch (ArgumentException)
		{
			// Still moving along...
		}
	}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:33,代码来源:TestWebHeaderCollection.cs


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