コード例 #1
0
ファイル: SumTests.cs プロジェクト: jnm2/corefx
        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); }));
        }
コード例 #2
0
 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); }));
 }
コード例 #3
0
 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)));
 }
コード例 #4
0
 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)));
 }
コード例 #5
0
 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); }));
 }
コード例 #6
0
ファイル: AggregateTests.cs プロジェクト: lodejard/AllNetCore
 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));
 }
コード例 #7
0
ファイル: ContainsTests.cs プロジェクト: karthikrajkumar/demo
 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)));
 }
コード例 #8
0
ファイル: ForAllTests.cs プロジェクト: berkaroad/dotnetcorefx
 public static void ForAll_AggregateException_Wraps_OperationCanceledException()
 {
     AssertThrows.OtherTokenCanceled((source, canceler) => source.ForAll(x => canceler()));
     AssertThrows.SameTokenNotCanceled((source, canceler) => source.ForAll(x => canceler()));
 }
コード例 #9
0
ファイル: AnyTests.cs プロジェクト: layomia/dotnet_runtime
 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; }));
 }