Akka.Streams.Tests.Dsl.GraphPartitionSpec.A_Partition_must_partition_to_three_subscribers C# (CSharp) Method

A_Partition_must_partition_to_three_subscribers() private method

private A_Partition_must_partition_to_three_subscribers ( ) : void
return void
        public void A_Partition_must_partition_to_three_subscribers()
        {
            this.AssertAllStagesStopped(() =>
            {
                var s = Sink.Seq<int>();
                var t = RunnableGraph.FromGraph(GraphDsl.Create(s, s, s, Tuple.Create, (b, sink1, sink2, sink3) =>
                {
                    var partition = b.Add(new Partition<int>(3, i => i > 3 ? 0 : (i < 3 ? 1 : 2)));
                    var source =
                        Source.From(Enumerable.Range(1, 5))
                            .MapMaterializedValue
                            <Tuple<Task<IImmutableList<int>>, Task<IImmutableList<int>>, Task<IImmutableList<int>>>>(
                                _ => null);

                    b.From(source).To(partition.In);
                    b.From(partition.Out(0)).To(sink1.Inlet);
                    b.From(partition.Out(1)).To(sink2.Inlet);
                    b.From(partition.Out(2)).To(sink3.Inlet);

                    return ClosedShape.Instance;
                })).Run(Materializer);

                var task = Task.WhenAll(t.Item1, t.Item2, t.Item3);
                task.Wait(TimeSpan.FromSeconds(3)).Should().BeTrue();
                task.Result[0].ShouldAllBeEquivalentTo(new[] {4, 5});
                task.Result[1].ShouldAllBeEquivalentTo(new[] {1, 2});
                task.Result[2].ShouldAllBeEquivalentTo(new[] {3});
            }, Materializer);
        }