public static void Sum_AggregateException_Wraps_OperationCanceledException() { AssertThrows.OtherTokenCanceled((source, canceler) => source.Sum(x => { canceler(); return(x); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Sum(x => { canceler(); return((int?)x); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Sum(x => { canceler(); return((long)x); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Sum(x => { canceler(); return((long?)x); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Sum(x => { canceler(); return((float)x); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Sum(x => { canceler(); return((float?)x); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Sum(x => { canceler(); return((double)x); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Sum(x => { canceler(); return((double?)x); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Sum(x => { canceler(); return((decimal)x); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Sum(x => { canceler(); return((decimal?)x); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Sum(x => { canceler(); return(x); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Sum(x => { canceler(); return((int?)x); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Sum(x => { canceler(); return((long)x); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Sum(x => { canceler(); return((long?)x); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Sum(x => { canceler(); return((float)x); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Sum(x => { canceler(); return((float?)x); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Sum(x => { canceler(); return((double)x); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Sum(x => { canceler(); return((double?)x); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Sum(x => { canceler(); return((decimal)x); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Sum(x => { canceler(); return((decimal?)x); })); }
public static void Count_AggregateException_Wraps_OperationCanceledException() { AssertThrows.OtherTokenCanceled((source, canceler) => source.Count(x => { canceler(); return(true); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.LongCount(x => { canceler(); return(true); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Count(x => { canceler(); return(true); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.LongCount(x => { canceler(); return(true); })); }
public static void ToLookup_AggregateException_Wraps_OperationCanceledException() { AssertThrows.OtherTokenCanceled((source, canceler) => source.ToLookup(x => x, new CancelingEqualityComparer <int>(canceler))); AssertThrows.OtherTokenCanceled((source, canceler) => source.ToLookup(x => x, y => y, new CancelingEqualityComparer <int>(canceler))); AssertThrows.SameTokenNotCanceled((source, canceler) => source.ToLookup(x => x, new CancelingEqualityComparer <int>(canceler))); AssertThrows.SameTokenNotCanceled((source, canceler) => source.ToLookup(x => x, y => y, new CancelingEqualityComparer <int>(canceler))); }
public static void SequenceEqual_AggregateException_Wraps_OperationCanceledException() { AssertThrows.OtherTokenCanceled((source, canceler) => source.OrderBy(x => x).SequenceEqual(ParallelEnumerable.Range(0, 128).AsOrdered(), new CancelingEqualityComparer <int>(canceler))); AssertThrows.OtherTokenCanceled((source, canceler) => ParallelEnumerable.Range(0, 128).AsOrdered().SequenceEqual(source.OrderBy(x => x), new CancelingEqualityComparer <int>(canceler))); AssertThrows.SameTokenNotCanceled((source, canceler) => source.OrderBy(x => x).SequenceEqual(ParallelEnumerable.Range(0, 128).AsOrdered(), new CancelingEqualityComparer <int>(canceler))); AssertThrows.SameTokenNotCanceled((source, canceler) => ParallelEnumerable.Range(0, 128).AsOrdered().SequenceEqual(source.OrderBy(x => x), new CancelingEqualityComparer <int>(canceler))); }
public static void First_AggregateException_Wraps_OperationCanceledException() { AssertThrows.OtherTokenCanceled((source, canceler) => source.First(x => { canceler(); return(false); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.FirstOrDefault(x => { canceler(); return(false); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.First(x => { canceler(); return(false); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.FirstOrDefault(x => { canceler(); return(false); })); }
public static void Aggregate_AggregateException_Wraps_OperationCanceledException() { AssertThrows.OtherTokenCanceled((source, canceler) => source.Aggregate((i, j) => { canceler(); return(j); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Aggregate(0, (i, j) => { canceler(); return(j); })); AssertThrows.OtherTokenCanceled((source, canceler) => source.Aggregate(0, (i, j) => { canceler(); return(j); }, i => i)); AssertThrows.OtherTokenCanceled((source, canceler) => source.Aggregate(0, (i, j) => { canceler(); return(j); }, (i, j) => i, i => i)); AssertThrows.OtherTokenCanceled((source, canceler) => source.Aggregate(() => 0, (i, j) => { canceler();; return(j); }, (i, j) => i, i => i)); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Aggregate((i, j) => { canceler(); return(j); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Aggregate(0, (i, j) => { canceler(); return(j); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Aggregate(0, (i, j) => { canceler(); return(j); }, i => i)); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Aggregate(0, (i, j) => { canceler(); return(j); }, (i, j) => i, i => i)); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Aggregate(() => 0, (i, j) => { canceler();; return(j); }, (i, j) => i, i => i)); }
public static void Contains_AggregateException_Wraps_OperationCanceledException() { AssertThrows.OtherTokenCanceled((source, canceler) => source.Contains(-1, new CancelingEqualityComparer <int>(canceler))); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Contains(-1, new CancelingEqualityComparer <int>(canceler))); }
public static void ForAll_AggregateException_Wraps_OperationCanceledException() { AssertThrows.OtherTokenCanceled((source, canceler) => source.ForAll(x => canceler())); AssertThrows.SameTokenNotCanceled((source, canceler) => source.ForAll(x => canceler())); }
public static void Any_AggregateException_Wraps_OperationCanceledException() { AssertThrows.OtherTokenCanceled((source, canceler) => source.Any(x => { canceler(); return false; })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.Any(x => { canceler(); return false; })); }