Skip to content

Commit

Permalink
Add test for support of large enumerables
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Chr authored and quinmars committed Nov 20, 2019
1 parent 0914a3d commit 2709284
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,34 @@ public void ToObservable_DesNotCallMoveNextAgainWhenSubscriptionIsDisposed()
Assert.Equal(1, moveNextCount);
Assert.False(fail);
}

[Fact]
public void ToObservable_SupportsLargeEnumerable()
{
using var evt = new ManualResetEvent(false);

var fail = false;

var xs = AsyncEnumerable.Range(0, 10000).ToObservable();
xs.Subscribe(new MyObserver<int>(
x =>
{
// ok
},
ex =>
{
fail = true;
evt.Set();
},
() =>
{
evt.Set();
}
));

evt.WaitOne();
Assert.False(fail);
}

private sealed class MyObserver<T> : IObserver<T>
{
Expand Down

0 comments on commit 2709284

Please sign in to comment.