public override IPublisher <int> CreatePublisher(long elements) { return(Flowable.Generate <int, int>(() => 1, (c, e) => { e.OnNext(c); if (c == elements) { e.OnComplete(); } return c + 1; })); }
public void Backpressured() { Flowable.Generate <int, int>(() => 1, (s, e) => { e.OnNext(s); if (s == 5) { e.OnComplete(); } return(s + 1); }) .Test(0) .AssertValues() .RequestMore(1) .AssertValues(1) .RequestMore(2) .AssertValues(1, 2, 3) .RequestMore(2) .AssertResult(1, 2, 3, 4, 5) ; }