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

ContentEncoding_ReadAndWriteProperty_ValueMatchesPriorSetValue() private method

        public void ContentEncoding_ReadAndWriteProperty_ValueMatchesPriorSetValue()
        {
            Assert.Equal(0, _headers.ContentEncoding.Count);

            _headers.ContentEncoding.Add("custom1");
            _headers.ContentEncoding.Add("custom2");

            Assert.Equal(2, _headers.ContentEncoding.Count);
            Assert.Equal(2, _headers.GetValues("Content-Encoding").Count());

            Assert.Equal("custom1", _headers.ContentEncoding.ElementAt(0));
            Assert.Equal("custom2", _headers.ContentEncoding.ElementAt(1));

            _headers.ContentEncoding.Clear();
            Assert.Equal(0, _headers.ContentEncoding.Count);
            Assert.False(_headers.Contains("Content-Encoding"));
        }
HttpContentHeadersTest