Akka.Streams.Tests.Dsl.FlowForeachSpec.A_Foreach_must_complete_future_with_failure_when_function_throws C# (CSharp) Method

A_Foreach_must_complete_future_with_failure_when_function_throws() private method

        public void A_Foreach_must_complete_future_with_failure_when_function_throws()
        {
            this.AssertAllStagesStopped(() =>
            {
                var error = new TestException("test");
                var future = Source.Single(1).RunForeach(_ =>
                {
                    throw error;
                }, Materializer);

                future.Invoking(f => f.Wait(TimeSpan.FromSeconds(3)))
                    .ShouldThrow<TestException>()
                    .And.Should()
                    .Be(error);
            }, Materializer);
        }
    }