public void RunBatchBlockTests() { Assert.True(IDataflowBlockTestHelper.TestToString(nameFormat => nameFormat != null ? new BatchBlock <int>(1, new GroupingDataflowBlockOptions() { NameFormat = nameFormat }) : new BatchBlock <int>(1))); Assert.True(ISourceBlockTestHelper.TestLinkTo <int[]>(ConstructBatchNewWithNMessages(1), 1)); Assert.True(ISourceBlockTestHelper.TestReserveMessageAndReleaseReservation <int[]>(ConstructBatchNewWithNMessages(1))); Assert.True(ISourceBlockTestHelper.TestConsumeMessage <int[]>(ConstructBatchNewWithNMessages(1))); Assert.True(ISourceBlockTestHelper.TestTryReceiveWithFilter <int[]>(ConstructBatchNewWithNMessages(1), 1)); Assert.True(ISourceBlockTestHelper.TestTryReceiveAll <int[]>(ConstructBatchNewWithNMessages(1), 1)); Assert.True(ISourceBlockTestHelper.TestCancelWhileReserve(ct => new BatchBlock <int>(1, new GroupingDataflowBlockOptions { CancellationToken = ct }), source => (source as BatchBlock <int>).Post(0), source => (source as BatchBlock <int>).OutputCount)); Assert.True(ITargetBlockTestHelper.TestOfferMessage <int>(new BatchBlock <int>(1))); Assert.True(ITargetBlockTestHelper.TestPost <int>(new BatchBlock <int>(1))); Assert.True(ITargetBlockTestHelper.TestComplete <int>(new BatchBlock <int>(1))); Assert.True(ITargetBlockTestHelper.TestCompletionTask <int>(new BatchBlock <int>(1))); Assert.True(ITargetBlockTestHelper.TestNonGreedyPost(new BatchBlock <int>(1, new GroupingDataflowBlockOptions { Greedy = false }))); Assert.True(TestReleaseOnReserveException(linkBadFirst: true)); Assert.True(TestReleaseOnReserveException(linkBadFirst: false)); Assert.True(TestMaxNumberOfGroups(greedy: true, sync: true)); Assert.True(TestMaxNumberOfGroups(greedy: true, sync: false)); // {non-greedy sync} is intentioanlly skipped because it is not supported by the block Assert.True(TestMaxNumberOfGroups(greedy: false, sync: false)); Assert.True(TestTriggerBatch(boundedCapacity: DataflowBlockOptions.Unbounded)); Assert.True(TestTriggerBatchRacingWithSendAsync(greedy: true)); Assert.True(TestTriggerBatchRacingWithSendAsync(greedy: false)); Assert.True(TestTriggerBatchRacingWithComplete(greedy: true)); Assert.True(TestTriggerBatchRacingWithComplete(greedy: false)); }