public async Task Objects_ArrayToStream_Cancel() { // arrange var list = new List <object?>(); var adapter = new EnumerableStreamAdapter(_objects.AsQueryable()); var cts = new CancellationTokenSource(); // act await foreach (var item in adapter.WithCancellation(cts.Token)) { list.Add(item); cts.Cancel(); } // assert Assert.Collection(list, s => Assert.Equal(_strings[0], s)); }
public async Task Objects_ArrayToStream() { // arrange var list = new List <object?>(); var adapter = new EnumerableStreamAdapter(_objects.AsQueryable()); // act await foreach (var item in adapter) { list.Add(item); } // assert for (var i = 0; i < list.Count; i++) { Assert.Equal(_objects[i], list[i]); } }