public void AllAsync() { IEnumerable <int> enumerable = new List <int> { 3, 4, 5 }; enumerable.AllAsync(i => Task.FromResult(i < 6)).Result.ShouldBeTrue(); enumerable.AllAsync(i => Task.FromResult(i == 4)).Result.ShouldBeFalse(); enumerable.AllAsync((i, c) => Task.FromResult(i < 6)).Result.ShouldBeTrue(); enumerable.AllAsync((i, c) => Task.FromResult(i == 4)).Result.ShouldBeFalse(); var cs = new CancellationTokenSource(); Should.Throw <OperationCanceledException>(() => enumerable.AllAsync(i => { if (i == 3) { cs.Cancel(); } return(Task.FromResult(i < 6)); }, cs.Token)); cs = new CancellationTokenSource(); Should.Throw <OperationCanceledException>(() => enumerable.AllAsync((i, c) => { if (i == 3) { cs.Cancel(); } return(Task.FromResult(i < 6)); }, cs.Token)); }