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