System.Net.Http.Tests.HttpHeaderValueCollectionTest.RemoveSpecialValue_AddRemoveSpecialValue_SpecialValueGetsRemoved C# (CSharp) Method

RemoveSpecialValue_AddRemoveSpecialValue_SpecialValueGetsRemoved() private method

        public void RemoveSpecialValue_AddRemoveSpecialValue_SpecialValueGetsRemoved()
        {
            MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri)));
            HttpHeaderValueCollection<Uri> collection = new HttpHeaderValueCollection<Uri>(knownHeader, headers,
                specialValue);

            collection.SetSpecialValue();
            Assert.True(collection.IsSpecialValueSet, "Special value not set.");
            Assert.Equal(1, headers.GetValues(knownHeader).Count());

            collection.RemoveSpecialValue();
            Assert.False(collection.IsSpecialValueSet, "Special value is set.");

            // Since the only header value was the "special value", removing it will remove the whole header
            // from the collection.
            Assert.False(headers.Contains(knownHeader));
        }
HttpHeaderValueCollectionTest