internal static bool BuffersToNonGreedyJoinToAction() { bool passed = true; const int ITERS = 2; var b1 = new BufferBlock <string>(); var b2 = new BufferBlock <int>(); var j = new JoinBlock <string, int>(new GroupingDataflowBlockOptions { Greedy = false }); b1.LinkWithCompletion(j.Target1); b2.LinkWithCompletion(j.Target2); var a = new ActionBlock <Tuple <string, int> >(t => Assert.True((t.Item1 == t.Item2.ToString()))); j.LinkWithCompletion(a); for (int i = 0; i < ITERS; i++) { b1.Post(i.ToString()); b2.Post(i); } b1.Complete(); b2.Complete(); a.Completion.Wait(); return(passed); }
internal static bool BuffersToNonGreedyJoinToAction() { bool passed = true; const int ITERS = 2; var b1 = new BufferBlock<string>(); var b2 = new BufferBlock<int>(); var j = new JoinBlock<string, int>(new GroupingDataflowBlockOptions { Greedy = false }); b1.LinkWithCompletion(j.Target1); b2.LinkWithCompletion(j.Target2); var a = new ActionBlock<Tuple<string, int>>(t => Assert.True((t.Item1 == t.Item2.ToString()))); j.LinkWithCompletion(a); for (int i = 0; i < ITERS; i++) { b1.Post(i.ToString()); b2.Post(i); } b1.Complete(); b2.Complete(); a.Completion.Wait(); return passed; }