예제 #1
0
 public static void Any_OperationCanceledException_PreCanceled()
 {
     AssertThrows.AlreadyCanceled(source => source.Any());
     AssertThrows.AlreadyCanceled(source => source.Any(x => true));
 }
예제 #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());
 }
예제 #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());
 }
예제 #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));
 }
예제 #6
0
 public static void ToDictionary_DuplicateKeys_ElementSelector_CustomComparator()
 {
     AssertThrows.Wrapped <ArgumentException>(() => ParallelEnumerable.Repeat(0, 2).ToDictionary(x => x, y => y, new ModularCongruenceComparer(2)));
 }
예제 #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());
 }
예제 #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));
 }
예제 #12
0
 public static void Contains_OperationCanceledException_PreCanceled()
 {
     AssertThrows.AlreadyCanceled(source => source.Contains(0));
     AssertThrows.AlreadyCanceled(source => source.Contains(0, EqualityComparer <int> .Default));
 }
예제 #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)));
 }
예제 #14
0
 public static void Contains_OperationCanceledException()
 {
     AssertThrows.EventuallyCanceled((source, canceler) => source.Contains(-1, new CancelingEqualityComparer <int>(canceler)));
 }
예제 #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));
 }
예제 #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));
 }
예제 #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)));
 }
예제 #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); }));
 }
예제 #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); }));
 }
예제 #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(); }));
 }
예제 #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(); }));
 }
예제 #24
0
 public static void ForAll_OperationCanceledException()
 {
     AssertThrows.EventuallyCanceled((source, canceler) => source.ForAll(x => canceler()));
 }
예제 #25
0
 public static void ToArray_OperationCanceledException_PreCanceled()
 {
     AssertThrows.AlreadyCanceled(source => source.ToArray());
 }
예제 #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()));
 }
예제 #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());
 }
예제 #28
0
 public static void ForAll_OperationCanceledException_PreCanceled()
 {
     AssertThrows.AlreadyCanceled(source => source.ForAll(x => { }));
 }
예제 #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());
 }
예제 #30
0
 public static void Any_OperationCanceledException()
 {
     AssertThrows.EventuallyCanceled((source, canceler) => source.Any(x => { canceler(); return(false); }));
 }