public void Throttle_for_single_cost_elements_must_send_elements_downstream_as_soon_as_time_comes()
{
this.AssertAllStagesStopped(() =>
{
var probe =
Source.From(Enumerable.Range(1, 10))
.Throttle(2, TimeSpan.FromMilliseconds(500), 0, ThrottleMode.Shaping)
.RunWith(this.SinkProbe<int>(), Materializer);
probe.Request(5);
var result = probe.ReceiveWhile(TimeSpan.FromMilliseconds(600), filter: x => x);
probe.ExpectNoMsg(TimeSpan.FromMilliseconds(100))
.ExpectNext(3)
.ExpectNoMsg(TimeSpan.FromMilliseconds(100))
.ExpectNext(4);
probe.Cancel();
// assertion may take longer then the throttle and therefore the next assertion fails
result.ShouldAllBeEquivalentTo(new[] { new OnNext(1), new OnNext(2) });
}, Materializer);
}