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

Contains_AddValuesThenCallContains_ReturnsTrueForExistingItemsFalseOtherwise() private method

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

            collection.Add(new Uri("http://www.example.org/1/"));
            collection.Add(new Uri("http://www.example.org/2/"));
            collection.Add(new Uri("http://www.example.org/3/"));

            Assert.True(collection.Contains(new Uri("http://www.example.org/2/")), "Expected true for existing item.");
            Assert.False(collection.Contains(new Uri("http://www.example.org/4/")),
                "Expected false for non-existing item.");
        }
HttpHeaderValueCollectionTest