public static void Any_OperationCanceledException_PreCanceled() { AssertThrows.AlreadyCanceled(source => source.Any()); AssertThrows.AlreadyCanceled(source => source.Any(x => true)); }
public static void Cast_Unordered_Assignable_InvalidCastException(int count) { AssertThrows.Wrapped <InvalidCastException>(() => UnorderedSources.Default(count).Select(x => (Int32)x).Cast <Castable>().ForAll(x => {; })); AssertThrows.Wrapped <InvalidCastException>(() => UnorderedSources.Default(count).Select(x => (Int32)x).Cast <Castable>().ToList()); }
public static void Cast_Unordered_InvalidCastException(int count) { AssertThrows.Wrapped <InvalidCastException>(() => UnorderedSources.Default(count).Cast <double>().ForAll(x => {; })); AssertThrows.Wrapped <InvalidCastException>(() => UnorderedSources.Default(count).Cast <double>().ToList()); }
public static void SingleOrDefault_OperationCanceledException_PreCanceled() { AssertThrows.AlreadyCanceled(source => source.SingleOrDefault()); AssertThrows.AlreadyCanceled(source => source.SingleOrDefault(x => true)); }
public static void ElementAt_OperationCanceledException_PreCanceled() { AssertThrows.AlreadyCanceled(source => source.ElementAt(0)); AssertThrows.AlreadyCanceled(source => source.ElementAtOrDefault(0)); }
public static void ToDictionary_DuplicateKeys_ElementSelector_CustomComparator() { AssertThrows.Wrapped <ArgumentException>(() => ParallelEnumerable.Repeat(0, 2).ToDictionary(x => x, y => y, new ModularCongruenceComparer(2))); }
public static void SingleOrDefault_OperationCanceledException() { AssertThrows.EventuallyCanceled((source, canceler) => source.SingleOrDefault(x => { canceler(); return(false); })); }
public static void ToLookup_AggregateException(Labeled <Operation> source, Labeled <Operation> operation) { AssertThrows.Wrapped <DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).ToLookup(x => x)); AssertThrows.Wrapped <DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).ToLookup(x => x, y => y)); }
public static void Average_AggregateException(Labeled <Operation> source, Labeled <Operation> operation) { AssertThrows.Wrapped <DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).Average()); }
public static void Contains_AggregateException() { AssertThrows.Wrapped <DeliberateTestException>(() => ParallelEnumerable.Range(0, 1).Contains(1, new FailingEqualityComparer <int>())); }
public static void Single_AggregateException(Labeled <Operation> source, Labeled <Operation> operation) { AssertThrows.Wrapped <DeliberateTestException>(() => operation.Item(DefaultStart, 2, source.Item).Single()); AssertThrows.Wrapped <DeliberateTestException>(() => operation.Item(DefaultStart, 2, source.Item).Single(x => true)); }
public static void Contains_OperationCanceledException_PreCanceled() { AssertThrows.AlreadyCanceled(source => source.Contains(0)); AssertThrows.AlreadyCanceled(source => source.Contains(0, EqualityComparer <int> .Default)); }
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 Contains_OperationCanceledException() { AssertThrows.EventuallyCanceled((source, canceler) => source.Contains(-1, new CancelingEqualityComparer <int>(canceler))); }
public static void ForAll_AggregateException() { AssertThrows.Wrapped <DeliberateTestException>(() => ParallelEnumerable.Range(0, 1).ForAll(x => { throw new DeliberateTestException(); })); AssertThrows.Wrapped <DeliberateTestException>(() => ParallelEnumerable.Range(0, 1).Select((Func <int, int>)(x => { throw new DeliberateTestException(); })).ForAll(x => { })); }
public static void Count_AggregateException(Labeled <Operation> source, Labeled <Operation> operation) { AssertThrows.Wrapped <DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).Count()); AssertThrows.Wrapped <DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).Count(x => true)); }
public static void ToDictionary_DuplicateKeys_ElementSelector() { AssertThrows.Wrapped <ArgumentException>(() => ParallelEnumerable.Repeat(0, 2).ToDictionary(x => x, y => y)); }
public static void ElementAtOrDefault_AggregateException(Labeled <Operation> source, Labeled <Operation> operation) { AssertThrows.Wrapped <DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).ElementAtOrDefault(DefaultSize - 1)); AssertThrows.Wrapped <DeliberateTestException>(() => operation.Item(DefaultStart, DefaultSize, source.Item).ElementAtOrDefault(DefaultSize + 1)); }
public static void ToDictionary_OperationCanceledException() { AssertThrows.EventuallyCanceled((source, canceler) => source.ToLookup(x => x, new CancelingEqualityComparer <int>(canceler))); AssertThrows.EventuallyCanceled((source, canceler) => source.ToLookup(x => x, y => y, new CancelingEqualityComparer <int>(canceler))); }
public static void Count_OperationCanceledException() { AssertThrows.EventuallyCanceled((source, canceler) => source.Count(x => { canceler(); return(true); })); AssertThrows.EventuallyCanceled((source, canceler) => source.LongCount(x => { canceler(); return(true); })); }
public static void SingleOrDefault_AggregateException_Wraps_OperationCanceledException() { AssertThrows.OtherTokenCanceled((source, canceler) => source.SingleOrDefault(x => { canceler(); return(false); })); AssertThrows.SameTokenNotCanceled((source, canceler) => source.SingleOrDefault(x => { canceler(); return(false); })); }
public static void CountLongCount_AggregateException() { AssertThrows.Wrapped <DeliberateTestException>(() => ParallelEnumerable.Range(0, 1).Count(x => { throw new DeliberateTestException(); })); AssertThrows.Wrapped <DeliberateTestException>(() => ParallelEnumerable.Range(0, 1).LongCount(x => { throw new DeliberateTestException(); })); }
public static void Single_AggregateException() { AssertThrows.Wrapped <DeliberateTestException>(() => ParallelEnumerable.Range(0, 1).Single(x => { throw new DeliberateTestException(); })); AssertThrows.Wrapped <DeliberateTestException>(() => ParallelEnumerable.Range(0, 1).SingleOrDefault(x => { throw new DeliberateTestException(); })); }
public static void ForAll_OperationCanceledException() { AssertThrows.EventuallyCanceled((source, canceler) => source.ForAll(x => canceler())); }
public static void ToArray_OperationCanceledException_PreCanceled() { AssertThrows.AlreadyCanceled(source => source.ToArray()); }
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 Cast_Assignable_InvalidCastException(Labeled <ParallelQuery <int> > labeled, int count) { AssertThrows.Wrapped <InvalidCastException>(() => labeled.Item.Select(x => (Int32)x).Cast <Castable>().ForAll(x => {; })); AssertThrows.Wrapped <InvalidCastException>(() => labeled.Item.Select(x => (Int32)x).Cast <Castable>().ToList()); }
public static void ForAll_OperationCanceledException_PreCanceled() { AssertThrows.AlreadyCanceled(source => source.ForAll(x => { })); }
public static void Cast_InvalidCastException(Labeled <ParallelQuery <int> > labeled, int count) { AssertThrows.Wrapped <InvalidCastException>(() => labeled.Item.Cast <double>().ForAll(x => {; })); AssertThrows.Wrapped <InvalidCastException>(() => labeled.Item.Cast <double>().ToList()); }
public static void Any_OperationCanceledException() { AssertThrows.EventuallyCanceled((source, canceler) => source.Any(x => { canceler(); return(false); })); }