|
@@ -59,7 +59,7 @@ namespace Tests
|
|
|
var ex = new Exception("Bang!");
|
|
|
var xs = Throw<int>(ex);
|
|
|
var ys = xs.Aggregate((x, y) => x * y);
|
|
|
- AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
|
|
|
+ AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
@@ -68,7 +68,7 @@ namespace Tests
|
|
|
var ex = new Exception("Bang!");
|
|
|
var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
|
|
|
var ys = xs.Aggregate(new Func<int, int, int>((x, y) => { throw ex; }));
|
|
|
- AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
|
|
|
+ AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
@@ -93,7 +93,7 @@ namespace Tests
|
|
|
var ex = new Exception("Bang!");
|
|
|
var xs = Throw<int>(ex);
|
|
|
var ys = xs.Aggregate(1, (x, y) => x * y);
|
|
|
- AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
|
|
|
+ AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
@@ -102,7 +102,7 @@ namespace Tests
|
|
|
var ex = new Exception("Bang!");
|
|
|
var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
|
|
|
var ys = xs.Aggregate(1, new Func<int, int, int>((x, y) => { throw ex; }));
|
|
|
- AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
|
|
|
+ AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
@@ -127,7 +127,7 @@ namespace Tests
|
|
|
var ex = new Exception("Bang!");
|
|
|
var xs = Throw<int>(ex);
|
|
|
var ys = xs.Aggregate(1, (x, y) => x * y, x => x + 1);
|
|
|
- AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
|
|
|
+ AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
@@ -136,7 +136,7 @@ namespace Tests
|
|
|
var ex = new Exception("Bang!");
|
|
|
var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
|
|
|
var ys = xs.Aggregate(1, (x, y) => { throw ex; }, x => x + 1);
|
|
|
- AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
|
|
|
+ AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
@@ -145,7 +145,7 @@ namespace Tests
|
|
|
var ex = new Exception("Bang!");
|
|
|
var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
|
|
|
var ys = xs.Aggregate<int, int, int>(1, (x, y) => x * y, x => { throw ex; });
|
|
|
- AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
|
|
|
+ AssertThrows<Exception>(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
|
|
|
}
|
|
|
}
|
|
|
}
|