本文整理汇总了C#中MockHeaders.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# MockHeaders.Remove方法的具体用法?C# MockHeaders.Remove怎么用?C# MockHeaders.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MockHeaders
的用法示例。
在下文中一共展示了MockHeaders.Remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Remove_RemoveNonExistingHeader_ReturnsFalse
public void Remove_RemoveNonExistingHeader_ReturnsFalse()
{
MockHeaders headers = new MockHeaders();
headers.Add("custom1", "customValue1");
Assert.Equal(1, headers.Count());
// Remove header from empty store
Assert.False(headers.Remove("doesntexist"));
Assert.Equal(1, headers.Count());
}
示例2: Remove_AddMultipleHeadersAndDeleteFirstAndLast_FirstAndLastHeaderRemoved
public void Remove_AddMultipleHeadersAndDeleteFirstAndLast_FirstAndLastHeaderRemoved()
{
MockHeaders headers = new MockHeaders();
headers.Add(knownHeader, rawPrefix + "1");
headers.TryAddWithoutValidation(knownHeader, rawPrefix + "2");
headers.Add("custom1", "customValue1");
headers.Add("custom2", "customValue2");
headers.Add("lastheader", "customValue3");
// Only 1 value should get parsed (call to Add() with known header value).
Assert.Equal(1, headers.Parser.TryParseValueCallCount);
// We added 4 different headers
Assert.Equal(4, headers.Count());
// Remove first header
Assert.True(headers.Remove(knownHeader));
Assert.Equal(3, headers.Count());
// Remove last header
Assert.True(headers.Remove("lastheader"));
Assert.Equal(2, headers.Count());
// The call to Count() triggers a TryParseValue for the TryAddWithoutValidation() value. Clear() should
// not cause any additional parsing operations.
Assert.Equal(2, headers.Parser.TryParseValueCallCount);
}
示例3: Remove_RemoveHeaderFromUninitializedHeaderStore_ReturnsFalse
public void Remove_RemoveHeaderFromUninitializedHeaderStore_ReturnsFalse()
{
MockHeaders headers = new MockHeaders();
// Remove header from uninitialized store (store collection is null)
Assert.False(headers.Remove(knownHeader));
Assert.Equal(0, headers.Count());
}
示例4: Remove_UseNullHeader_Throw
public void Remove_UseNullHeader_Throw()
{
MockHeaders headers = new MockHeaders();
Assert.Throws<ArgumentException>(() => { headers.Remove(null); });
}