Beispiel #1
0
 public static void Any_OperationCanceledException_PreCanceled()
 {
     AssertThrows.AlreadyCanceled(source => source.Any());
     AssertThrows.AlreadyCanceled(source => source.Any(x => true));
 }
Beispiel #2
0
 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());
 }
Beispiel #3
0
 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());
 }
Beispiel #4
0
 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));
 }
Beispiel #6
0
 public static void ToDictionary_DuplicateKeys_ElementSelector_CustomComparator()
 {
     AssertThrows.Wrapped <ArgumentException>(() => ParallelEnumerable.Repeat(0, 2).ToDictionary(x => x, y => y, new ModularCongruenceComparer(2)));
 }
Beispiel #7
0
 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());
 }
Beispiel #10
0
 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));
 }
Beispiel #12
0
 public static void Contains_OperationCanceledException_PreCanceled()
 {
     AssertThrows.AlreadyCanceled(source => source.Contains(0));
     AssertThrows.AlreadyCanceled(source => source.Contains(0, EqualityComparer <int> .Default));
 }
Beispiel #13
0
 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)));
 }
Beispiel #14
0
 public static void Contains_OperationCanceledException()
 {
     AssertThrows.EventuallyCanceled((source, canceler) => source.Contains(-1, new CancelingEqualityComparer <int>(canceler)));
 }
Beispiel #15
0
 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));
 }
Beispiel #17
0
 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));
 }
Beispiel #19
0
 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)));
 }
Beispiel #20
0
 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); }));
 }
Beispiel #21
0
 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); }));
 }
Beispiel #22
0
 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(); }));
 }
Beispiel #23
0
 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(); }));
 }
Beispiel #24
0
 public static void ForAll_OperationCanceledException()
 {
     AssertThrows.EventuallyCanceled((source, canceler) => source.ForAll(x => canceler()));
 }
Beispiel #25
0
 public static void ToArray_OperationCanceledException_PreCanceled()
 {
     AssertThrows.AlreadyCanceled(source => source.ToArray());
 }
Beispiel #26
0
 public static void ForAll_AggregateException_Wraps_OperationCanceledException()
 {
     AssertThrows.OtherTokenCanceled((source, canceler) => source.ForAll(x => canceler()));
     AssertThrows.SameTokenNotCanceled((source, canceler) => source.ForAll(x => canceler()));
 }
Beispiel #27
0
 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());
 }
Beispiel #28
0
 public static void ForAll_OperationCanceledException_PreCanceled()
 {
     AssertThrows.AlreadyCanceled(source => source.ForAll(x => { }));
 }
Beispiel #29
0
 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());
 }
Beispiel #30
0
 public static void Any_OperationCanceledException()
 {
     AssertThrows.EventuallyCanceled((source, canceler) => source.Any(x => { canceler(); return(false); }));
 }