public async Task TestReserveReleaseConsume()
        {
            var b2 = new BatchedJoinBlock <int, int>(2);

            b2.Target1.Post(1);
            b2.Target2.Post(2);
            await DataflowTestHelpers.TestReserveAndRelease(b2);

            b2 = new BatchedJoinBlock <int, int>(2);
            b2.Target1.Post(1);
            b2.Target2.Post(2);
            await DataflowTestHelpers.TestReserveAndConsume(b2);

            var b3 = new BatchedJoinBlock <int, int, int>(1);

            b3.Target2.Post(3);
            await DataflowTestHelpers.TestReserveAndRelease(b3);

            b3 = new BatchedJoinBlock <int, int, int>(4);
            b3.Target3.Post(1);
            b3.Target3.Post(2);
            b3.Target3.Post(3);
            b3.Target2.Post(3);
            await DataflowTestHelpers.TestReserveAndConsume(b3);
        }
Beispiel #2
0
        public async Task TestReserveReleaseConsume()
        {
            var wb = new WriteOnceBlock <int>(i => i * 2);

            wb.Post(1);
            await DataflowTestHelpers.TestReserveAndRelease(wb, reservationIsTargetSpecific : false);

            wb = new WriteOnceBlock <int>(i => i * 2);
            wb.Post(2);
            await DataflowTestHelpers.TestReserveAndConsume(wb, reservationIsTargetSpecific : false);
        }
Beispiel #3
0
        public async Task TestReserveReleaseConsume()
        {
            var bb = new BroadcastBlock <int>(i => i * 2);

            bb.Post(1);
            await DataflowTestHelpers.TestReserveAndRelease(bb, reservationIsTargetSpecific : false);

            bb = new BroadcastBlock <int>(i => i * 2);
            bb.Post(2);
            await DataflowTestHelpers.TestReserveAndConsume(bb, reservationIsTargetSpecific : false);
        }
Beispiel #4
0
        public async Task TestReserveReleaseConsume()
        {
            var bb = new BufferBlock <int>();

            bb.Post(1);
            await DataflowTestHelpers.TestReserveAndRelease(bb);

            bb = new BufferBlock <int>();
            bb.Post(2);
            await DataflowTestHelpers.TestReserveAndConsume(bb);
        }
Beispiel #5
0
        public async Task TestReserveReleaseConsume()
        {
            var tb = new TransformBlock <int, int>(i => i * 2);

            tb.Post(1);
            await DataflowTestHelpers.TestReserveAndRelease(tb);

            tb = new TransformBlock <int, int>(i => i * 2);
            tb.Post(2);
            await DataflowTestHelpers.TestReserveAndConsume(tb);
        }
Beispiel #6
0
        public async Task TestReserveReleaseConsume()
        {
            var bb = new BatchBlock <int>(2);

            bb.PostItems(1, 2);
            await DataflowTestHelpers.TestReserveAndRelease(bb);

            bb = new BatchBlock <int>(2);
            bb.PostItems(1, 2);
            await DataflowTestHelpers.TestReserveAndConsume(bb);
        }