public async Task Should_remain_in_order() { var values = new List <int>(); var observable = new AsyncObservable <List <int> >(); ConnectHandle observer = observable.Connect(values); for (int i = 0; i < 10000; i++) { int index = i; observable.Notify(async x => x.Add(index)); } observer.Disconnect(); Assert.AreEqual(10000, values.Count); Assert.IsTrue(values.SequenceEqual(Enumerable.Range(0, 10000).Select(x => x).ToList())); }
public async Task Should_remain_in_order() { var values = new List<int>(); var observable = new AsyncObservable<List<int>>(); ConnectHandle observer = observable.Connect(values); for (int i = 0; i < 10000; i++) { int index = i; observable.Notify(async x => x.Add(index)); } observer.Disconnect(); Assert.AreEqual(10000, values.Count); Assert.IsTrue(values.SequenceEqual(Enumerable.Range(0, 10000).Select(x => x).ToList())); }