Akka.Streams.Tests.Dsl.FlowLimitWeightedSpec.Limit_must_throw_a_StreamLimitReachedException_when_n_lower_than_accumulated_cost C# (CSharp) Method

Limit_must_throw_a_StreamLimitReachedException_when_n_lower_than_accumulated_cost() private method

        public void Limit_must_throw_a_StreamLimitReachedException_when_n_lower_than_accumulated_cost()
        {
            var input = new[] { "this", "is", "some", "string" };
            var n = input.Aggregate((s, s1) => s + s1).Length - 1;
            Func<string, long> costFunction = e => e.Length;
            var future = Source.From(input)
                .LimitWeighted(n, costFunction)
                .Grouped(1000)
                .RunWith(Sink.FirstOrDefault<IEnumerable<string>>(), Materializer);

            future.Invoking(f => f.Wait(TimeSpan.FromMilliseconds(300))).ShouldThrow<StreamLimitReachedException>();
        }
    }