public async Task ToListAsyncCorrectlyHandlesEmptyCollections() { var seq = new PagedAlphabet(4, 0); var list = await seq.ToListAsync(); Assert.Empty(list); }
public async Task ToListAsyncSupportsCancellation() { PagedAlphabet seq = new PagedAlphabet(4, 10); //Call with an already cancelled cancellation token using CancellationTokenSource source = new CancellationTokenSource(); source.Cancel(); await Assert.ThrowsAsync <OperationCanceledException>(async() => await seq.ToListAsync(source.Token)); }
public async Task ToListAsyncCollectsAllElementsOfSequence() { var seq = new PagedAlphabet(4, 10); var list = await seq.ToListAsync(); Assert.Equal(10, list.Count); Assert.Equal("A", list.First()); Assert.Equal("J", list.Last()); }