Akka.Streams.Tests.Extra.FlowTimedSpec.Timed_Flow_must_measure_time_it_takes_from_start_to_complete_by_wrapping_operations C# (CSharp) Метод

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

        public void Timed_Flow_must_measure_time_it_takes_from_start_to_complete_by_wrapping_operations()
        {
            this.AssertAllStagesStopped(() =>
            {
                var probe = CreateTestProbe();

                var flow =
                    Flow.Create<int>()
                        .Timed(f => f.Select(x => (double)x).Select(x => (int)x).Select(x => x.ToString()),
                            d => probe.Tell(d))
                        .Select(s => s + "!");

                var t = flow.RunWith(Source.AsSubscriber<int>(), Sink.AsPublisher<string>(false), Materializer);
                var flowIn = t.Item1;
                var flowOut = t.Item2;

                var c1 = TestSubscriber.CreateManualProbe<string>(this);
                flowOut.Subscribe(c1);

                var p = Source.From(Enumerable.Range(0, 101)).RunWith(Sink.AsPublisher<int>(false), Materializer);
                p.Subscribe(flowIn);

                var sub = c1.ExpectSubscription();
                sub.Request(200);
                Enumerable.Range(0, 101).ForEach(i => c1.ExpectNext(i + "!"));
                c1.ExpectComplete();

                var duration = probe.ExpectMsg<TimeSpan>();
                _helper.WriteLine($"Took: {duration}");
            }, Materializer);
        }
    }