System.Net.Http.Tests.HttpContentHeadersTest.Allow_UseAddMethod_AddedValueCanBeRetrievedUsingProperty C# (CSharp) Method

Allow_UseAddMethod_AddedValueCanBeRetrievedUsingProperty() private method

        public void Allow_UseAddMethod_AddedValueCanBeRetrievedUsingProperty()
        {
            _headers.TryAddWithoutValidation("Allow", ",custom1, custom2, custom3,");

            Assert.Equal(3, _headers.Allow.Count);
            Assert.Equal(3, _headers.GetValues("Allow").Count());

            Assert.Equal("custom1", _headers.Allow.ElementAt(0));
            Assert.Equal("custom2", _headers.Allow.ElementAt(1));
            Assert.Equal("custom3", _headers.Allow.ElementAt(2));

            _headers.Allow.Clear();
            Assert.Equal(0, _headers.Allow.Count);
            Assert.False(_headers.Contains("Allow"));
        }
HttpContentHeadersTest