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

ContentType_ReadAndWriteProperty_ValueMatchesPriorSetValue() private method

        public void ContentType_ReadAndWriteProperty_ValueMatchesPriorSetValue()
        {
            MediaTypeHeaderValue value = new MediaTypeHeaderValue("text/plain");
            value.CharSet = "utf-8";
            value.Parameters.Add(new NameValueHeaderValue("custom", "value"));

            Assert.Null(_headers.ContentType);

            _headers.ContentType = value;
            Assert.Same(value, _headers.ContentType);

            _headers.ContentType = null;
            Assert.Null(_headers.ContentType);
        }
HttpContentHeadersTest