Esempio n. 1
0
        public void HappyFlow()
        {
            BatchingPipe <Packet <byte> > packetsPipe = new BatchingPipe <Packet <byte> >();

            _ = packetsPipe.ProduceCompleteAsync(FixedTestData.CreatePackets());

            Stream sut = packetsPipe.ToReadOnlyStream();

            FixedTestData.AssertStream(sut);
        }
        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;
        }
Esempio n. 3
0
        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());
        }