public void ResponseBodySetPipeReaderReturnsSameValue() { var context = new DefaultHttpContext(); var feature = new ResponseBodyPipeFeature(context); var pipeWriter = new Pipe().Writer; feature.Writer = pipeWriter; Assert.Equal(pipeWriter, feature.Writer); }
public void ResponseBodyReturnsStreamPipeReader() { var context = new DefaultHttpContext(); var expectedStream = new MemoryStream(); context.Response.Body = expectedStream; var feature = new ResponseBodyPipeFeature(context); var pipeBody = feature.Writer; Assert.NotNull(pipeBody); }
public void ResponseBodyReturnsStreamPipeReader() { var context = new DefaultHttpContext(); 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); }
public void ResponseBodyGetPipeWriterAfterSettingBodyTwice() { var context = new DefaultHttpContext(); var expectedStream = new MemoryStream(); context.Response.Body = new MemoryStream(); var provider = new ResponseBodyPipeFeature(context); var pipeBody = provider.ResponseBodyPipe; context.Response.Body = expectedStream; pipeBody = provider.ResponseBodyPipe; Assert.True(pipeBody is StreamPipeWriter); Assert.Equal(expectedStream, (pipeBody as StreamPipeWriter).InnerStream); }