Пример #1
0
        public void ResponseBodySetPipeReaderReturnsSameValue()
        {
            var context = new DefaultProtoContext();
            var feature = new ResponseBodyPipeFeature(context);

            var pipeWriter = new Pipe().Writer;

            feature.Writer = pipeWriter;

            Assert.Equal(pipeWriter, feature.Writer);
        }
Пример #2
0
        public void ResponseBodyReturnsStreamPipeReader()
        {
            var context        = new DefaultProtoContext();
            var expectedStream = new MemoryStream();

            context.Response.Body = expectedStream;

            var feature = new ResponseBodyPipeFeature(context);

            var pipeBody = feature.Writer;

            Assert.True(pipeBody is StreamPipeWriter);
            Assert.Equal(expectedStream, (pipeBody as StreamPipeWriter).InnerStream);
        }