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

Limit_must_always_exhaust_a_source_regardless_of_n_as_long_as_n_is_greater_than_0_if_cost_is_0() private method

        public void Limit_must_always_exhaust_a_source_regardless_of_n_as_long_as_n_is_greater_than_0_if_cost_is_0()
        {
            var input = Enumerable.Range(1, 15).ToList();
            var n = 1; // must not matter since costFn always evaluates to 0
            Func<int, long> costFunction = e => 0L;
            var future = Source.From(input)
                .LimitWeighted(n, costFunction)
                .Grouped(1000)
                .RunWith(Sink.FirstOrDefault<IEnumerable<int>>(), Materializer);

            future.Wait(TimeSpan.FromMilliseconds(300)).Should().BeTrue();
            future.Result.ShouldAllBeEquivalentTo(input);

        }