public void HappyFlow() { BatchingPipe <Packet <byte> > packetsPipe = new BatchingPipe <Packet <byte> >(); _ = packetsPipe.ProduceCompleteAsync(FixedTestData.CreatePackets()); Stream sut = packetsPipe.ToReadOnlyStream(); FixedTestData.AssertStream(sut); }
public void HappyFlow() { CheckDisposeStream checkDisposeStream = new CheckDisposeStream(); CombinedStream sut = new CombinedStream(FixedTestData.CreateStreams(checkDisposeStream)); FixedTestData.AssertStream(sut, FixedTestData.Structure); Assert.IsTrue(checkDisposeStream.DisposeCalled); }
public async Task HappyFlow() { Stream inputStream = FixedTestData.CreateStream(); IPipe <Packet <byte> > duplicateBuffer = new BatchingPipe <Packet <byte> >(); DuplicateStream sut = new DuplicateStream(inputStream, duplicateBuffer.ToWriteOnlyStream()); // As sut is read for assertion, in the process it should start to write data to duplication destination Task assertSutStream = Task.Run(() => FixedTestData.AssertStream(sut)); // Thus with next task we should be able to assert both streams at the same time. Task assertDuplicatedStream = Task.Run(() => FixedTestData.AssertStream(duplicateBuffer.ToReadOnlyStream())); await assertSutStream; await assertDuplicatedStream; }
public void HappyFlow() { Stream testData = new CombinedStream(FixedTestData.CreateStreams()); BatchingPipe <Packet <byte> > packetsPipe = new BatchingPipe <Packet <byte> >(); Stream sut = packetsPipe.ToWriteOnlyStream(); Task.Run(async() => { await testData.CopyToAsync(sut); await sut.DisposeAsync(); // Closing/Disposing adapter triggers completion of producer by default. }); FixedTestData.AssertStream(packetsPipe.ToReadOnlyStream()); //FixedTestData.DebugStream(packetsPipe.ToReadOnlyStream()); }