Akka.Streams.Tests.Dsl.FlowRecoverWithSpec.A_RecoverWith_must_terminate_with_exception_if_alternative_source_failed C# (CSharp) Метод

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

        public void A_RecoverWith_must_terminate_with_exception_if_alternative_source_failed()
        {
            this.AssertAllStagesStopped(() =>
            {
                var probe = Source.From(Enumerable.Range(1, 3))
                    .Select(x =>
                    {
                        if(x==3)
                            throw new IndexOutOfRangeException();
                        return x;
                    })
                    .RecoverWith(ex =>
                    {
                        if (ex is IndexOutOfRangeException)
                            return Source.From(new[] {11, 22}).Select(x =>
                            {
                                if (x == 22)
                                    throw Ex;
                                return x;
                            });
                        return null;
                    })
                    .RunWith(this.SinkProbe<int>(), Materializer);

                probe
                    .Request(2)
                    .ExpectNext(1, 2);

                probe
                    .Request(1)
                    .ExpectNext(11);

                probe
                    .Request(1)
                    .ExpectError().Should().Be(Ex);
            }, Materializer);
        }
    }