public void GetReaderAtBodyContents_Throws()
        {
            HttpRequestMessage request = new HttpRequestMessage();

            request.Content = new ByteArrayContent(new byte[1] {
                0
            });
            HttpMessage message = new HttpMessage(request);

            ExceptionAssert.Throws(
                typeof(NotSupportedException),
                "HttpMessage.GetReaderAtBodyContents should have thrown because the message can't be read/written.",
                () =>
            {
                message.GetReaderAtBodyContents();
            });
        }
Beispiel #2
0
        public void GetReaderAtBodyContents_Throws()
        {
            HttpRequestMessage request = new HttpRequestMessage();
            request.Content = new ByteArrayContent(new byte[1] { 0 });
            HttpMessage message = new HttpMessage(request);

            ExceptionAssert.Throws<NotSupportedException>(
                SR.MessageReadWriteCopyNotSupported("ToHttpRequestMessage", "ToHttpResponseMessage", typeof(Message).FullName),
                () =>
                {
                    message.GetReaderAtBodyContents();
                });
        }