public void SimplePipeline() { // Arrange var data = GetRandomBytes(100); var sourceStream = new MemoryStream(data); var targetStream = new MemoryStream(); using (var source = new StreamSource(sourceStream, false)) using (var target = new StreamSink(targetStream, false)) { // Act source .Pipe(target) .Drain(); // Assert Expect(targetStream) .To.Contain.Only(data); } }
public void ThreeLevelPipeline() { // Arrange var intermediate = new NullPassThrough(); var data = GetRandomBytes(100); var sourceStream = new MemoryStream(data); var targetStream = new MemoryStream(); using (var source = new StreamSource(sourceStream, false)) using (var target = new StreamSink(targetStream, false)) { // Act source .Pipe(intermediate) .Pipe(target) .Drain(); // Assert Expect(targetStream) .To.Contain.Only(data); } }