Akka.Streams.Tests.Dsl.GraphPartitionSpec.A_Partition_must_cancel_upstream_when_downstreams_cancel C# (CSharp) Méthode

A_Partition_must_cancel_upstream_when_downstreams_cancel() private méthode

        public void A_Partition_must_cancel_upstream_when_downstreams_cancel()
        {
            this.AssertAllStagesStopped(() =>
            {
                var p1 = TestPublisher.CreateProbe<int>(this);
                var c1 = TestSubscriber.CreateProbe<int>(this);
                var c2 = TestSubscriber.CreateProbe<int>(this);

                RunnableGraph.FromGraph(GraphDsl.Create(b =>
                {
                    var partition = b.Add(new Partition<int>(2, i => i < 6 ? 0 : 1));
                    var source = Source.FromPublisher(p1.Publisher);

                    b.From(source).To(partition.In);
                    b.From(partition.Out(0))
                        .Via(Flow.Create<int>().Buffer(16, OverflowStrategy.Backpressure))
                        .To(Sink.FromSubscriber(c1));
                    b.From(partition.Out(1))
                        .Via(Flow.Create<int>().Buffer(16, OverflowStrategy.Backpressure))
                        .To(Sink.FromSubscriber(c2));

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

                var p1Sub = p1.ExpectSubscription();
                var sub1 = c1.ExpectSubscription();
                var sub2 = c2.ExpectSubscription();
                sub1.Request(3);
                sub2.Request(3);
                p1Sub.SendNext(1);
                p1Sub.SendNext(8);
                c1.ExpectNext(1);
                c2.ExpectNext(8);
                p1Sub.SendNext(2);
                c1.ExpectNext(2);
                sub1.Cancel();
                sub2.Cancel();
                p1Sub.ExpectCancellation();
            }, Materializer);
        }