示例#1
0
        public void AddHeaders_SpecialHeaderValuesOnDestinationNotOnSource_NotCopied()
        {
            // Positive
            HttpRequestHeaders destination = new HttpRequestHeaders();
            destination.ExpectContinue = true;
            destination.TransferEncodingChunked = true;
            destination.ConnectionClose = true;
            Assert.NotNull(destination.ExpectContinue);
            Assert.NotNull(destination.TransferEncodingChunked);
            Assert.NotNull(destination.ConnectionClose);
            Assert.True(destination.ExpectContinue.Value);
            Assert.True(destination.TransferEncodingChunked.Value);
            Assert.True(destination.ConnectionClose.Value);

            HttpRequestHeaders source = new HttpRequestHeaders();
            Assert.Null(source.ExpectContinue);
            Assert.Null(source.TransferEncodingChunked);
            Assert.Null(source.ConnectionClose);

            destination.AddHeaders(source);
            Assert.Null(source.ExpectContinue);
            Assert.Null(source.TransferEncodingChunked);
            Assert.Null(source.ConnectionClose);
            Assert.NotNull(destination.ExpectContinue);
            Assert.NotNull(destination.TransferEncodingChunked);
            Assert.NotNull(destination.ConnectionClose);
            Assert.True(destination.ExpectContinue.Value);
            Assert.True(destination.TransferEncodingChunked.Value);
            Assert.True(destination.ConnectionClose.Value);

            // Negitive
            destination = new HttpRequestHeaders();
            destination.ExpectContinue = false;
            destination.TransferEncodingChunked = false;
            destination.ConnectionClose = false;
            Assert.NotNull(destination.ExpectContinue);
            Assert.NotNull(destination.TransferEncodingChunked);
            Assert.NotNull(destination.ConnectionClose);
            Assert.False(destination.ExpectContinue.Value);
            Assert.False(destination.TransferEncodingChunked.Value);
            Assert.False(destination.ConnectionClose.Value);

            source = new HttpRequestHeaders();
            Assert.Null(source.ExpectContinue);
            Assert.Null(source.TransferEncodingChunked);
            Assert.Null(source.ConnectionClose);

            destination.AddHeaders(source);
            Assert.Null(source.ExpectContinue);
            Assert.Null(source.TransferEncodingChunked);
            Assert.Null(source.ConnectionClose);
            Assert.NotNull(destination.ExpectContinue);
            Assert.NotNull(destination.TransferEncodingChunked);
            Assert.NotNull(destination.ConnectionClose);
            Assert.False(destination.ExpectContinue.Value);
            Assert.False(destination.TransferEncodingChunked.Value);
            Assert.False(destination.ConnectionClose.Value);
        }