Akka.Streams.Tests.Dsl.GraphPartitionSpec.A_Partition_must_fail_stage_if_partitioner_outcome_is_out_of_bound C# (CSharp) Метод

A_Partition_must_fail_stage_if_partitioner_outcome_is_out_of_bound() приватный Метод

private A_Partition_must_fail_stage_if_partitioner_outcome_is_out_of_bound ( ) : void
Результат void
        public void A_Partition_must_fail_stage_if_partitioner_outcome_is_out_of_bound()
        {
            this.AssertAllStagesStopped(() =>
            {
                var c1 = TestSubscriber.CreateProbe<int>(this);

                RunnableGraph.FromGraph(GraphDsl.Create(b =>
                {
                    var partition = b.Add(new Partition<int>(2, i => i < 0 ? -1 : 0));
                    var source = Source.From(new[] { -3 });

                    b.From(source).To(partition.In);
                    b.From(partition.Out(0)).To(Sink.FromSubscriber(c1));
                    b.From(partition.Out(1)).To(Sink.Ignore<int>().MapMaterializedValue(_ => NotUsed.Instance));

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


                c1.Request(1);
                var error = c1.ExpectError();
                error.Should().BeOfType<PartitionOutOfBoundsException>();
                error.Message.Should()
                    .Be(
                        "partitioner must return an index in the range [0,1]. returned: [-1] for input [Int32].");
            }, Materializer);
        }
    }