浏览代码

Reduce places where magic timeout values are used.

Bart De Smet 7 年之前
父节点
当前提交
9b1c16ec0a
共有 32 个文件被更改,包括 90 次插入83 次删除
  1. 10 0
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/AsyncEnumerableTests.cs
  2. 7 7
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Aggregate.cs
  3. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/All.cs
  4. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Any.cs
  5. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Concat.cs
  6. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Count.cs
  7. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/DefaultIfEmpty.cs
  8. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ElementAt.cs
  9. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ElementAtOrDefault.cs
  10. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/First.cs
  11. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/FirstOrDefault.cs
  12. 4 4
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ForEachAsync.cs
  13. 3 3
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/GroupBy.cs
  14. 5 5
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/GroupJoin.cs
  15. 5 5
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Join.cs
  16. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Last.cs
  17. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/LastOrDefault.cs
  18. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/LongCount.cs
  19. 4 4
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/OrderBy.cs
  20. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs
  21. 8 8
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SelectMany.cs
  22. 4 4
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SequenceEqual.cs
  23. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Single.cs
  24. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SingleOrDefault.cs
  25. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs
  26. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SkipWhile.cs
  27. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs
  28. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/TakeWhile.cs
  29. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToArray.cs
  30. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToList.cs
  31. 4 6
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Where.cs
  32. 3 4
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Zip.cs

+ 10 - 0
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/AsyncEnumerableTests.cs

@@ -46,6 +46,16 @@ namespace Tests
             }
         }
 
+        public void AssertThrowsAsync(Task t, Exception e)
+        {
+            AssertThrows(() => t.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(e));
+        }
+
+        public void AssertThrowsAsync<T>(ValueTask<T> t, Exception e)
+        {
+            AssertThrows(() => t.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(e));
+        }
+
         public async Task NoNextAsync<T>(IAsyncEnumerator<T> e)
         {
             Assert.False(await e.MoveNextAsync());

+ 7 - 7
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Aggregate.cs

@@ -58,7 +58,7 @@ namespace Tests
             var ex = new Exception("Bang!");
             var xs = Throw<int>(ex);
             var ys = xs.Aggregate((x, y) => x * y);
-            AssertThrows(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(ys, ex);
         }
 
         [Fact]
@@ -67,7 +67,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(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(ys, ex);
         }
 
         [Fact]
@@ -92,7 +92,7 @@ namespace Tests
             var ex = new Exception("Bang!");
             var xs = Throw<int>(ex);
             var ys = xs.Aggregate(1, (x, y) => x * y);
-            AssertThrows(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(ys, ex);
         }
 
         [Fact]
@@ -101,7 +101,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(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(ys, ex);
         }
 
         [Fact]
@@ -126,7 +126,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(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(ys, ex);
         }
 
         [Fact]
@@ -135,7 +135,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(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(ys, ex);
         }
 
         [Fact]
@@ -144,7 +144,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(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(ys, ex);
         }
     }
 }

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/All.cs

@@ -41,7 +41,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).All(x => x % 2 == 0);
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -49,7 +49,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().All(new Func<int, bool>(x => { throw ex; }));
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
     }
 }

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Any.cs

@@ -43,7 +43,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).Any(x => x % 2 == 0);
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -51,7 +51,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = new[] { 2, 8, 4 }.ToAsyncEnumerable().Any(new Func<int, bool>(x => { throw ex; }));
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Concat.cs

@@ -44,7 +44,7 @@ namespace Tests
             await HasNextAsync(e, 1);
             await HasNextAsync(e, 2);
             await HasNextAsync(e, 3);
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -54,7 +54,7 @@ namespace Tests
             var ys = Throw<int>(ex).Concat(new[] { 4, 5, 6 }.ToAsyncEnumerable());
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Count.cs

@@ -46,7 +46,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Count(new Func<int, bool>(x => { throw ex; }));
-            AssertThrows(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(ys, ex);
         }
     }
 }

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/DefaultIfEmpty.cs

@@ -92,7 +92,7 @@ namespace Tests
             var xs = Throw<int>(ex).DefaultIfEmpty();
 
             var e = xs.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -102,7 +102,7 @@ namespace Tests
             var xs = Throw<int>(ex).DefaultIfEmpty(24);
 
             var e = xs.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ElementAt.cs

@@ -63,7 +63,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).ElementAt(15);
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
     }
 }

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ElementAtOrDefault.cs

@@ -67,7 +67,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).ElementAtOrDefault(15);
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
     }
 }

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/First.cs

@@ -65,7 +65,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).First();
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -73,7 +73,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).First(x => true);
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/FirstOrDefault.cs

@@ -65,7 +65,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).FirstOrDefault();
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -73,7 +73,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).FirstOrDefault(x => true);
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]

+ 4 - 4
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ForEachAsync.cs

@@ -53,7 +53,7 @@ namespace Tests
             var ex = new Exception("Bang");
             var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
 
-            AssertThrows(() => xs.ForEachAsync(x => { throw ex; }).Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(xs.ForEachAsync(x => { throw ex; }), ex);
         }
 
         [Fact]
@@ -62,7 +62,7 @@ namespace Tests
             var ex = new Exception("Bang");
             var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
 
-            AssertThrows(() => xs.ForEachAsync((x, i) => { throw ex; }).Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(xs.ForEachAsync((x, i) => { throw ex; }), ex);
         }
 
         [Fact]
@@ -71,7 +71,7 @@ namespace Tests
             var ex = new Exception("Bang");
             var xs = Throw<int>(ex);
 
-            AssertThrows(() => xs.ForEachAsync(x => { throw ex; }).Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(xs.ForEachAsync(x => { throw ex; }), ex);
         }
 
         [Fact]
@@ -80,7 +80,7 @@ namespace Tests
             var ex = new Exception("Bang");
             var xs = Throw<int>(ex);
 
-            AssertThrows(() => xs.ForEachAsync((x, i) => { throw ex; }).Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(xs.ForEachAsync((x, i) => { throw ex; }), ex);
         }
     }
 }

+ 3 - 3
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/GroupBy.cs

@@ -172,7 +172,7 @@ namespace Tests
             var ys = xs.GroupBy(x => x);
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -237,7 +237,7 @@ namespace Tests
             var ys = xs.GroupBy(new Func<int, int>(x => { throw ex; }));
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -249,7 +249,7 @@ namespace Tests
 
             var e = ys.GetAsyncEnumerator();
 
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
 
             //Assert.True(e.MoveNext().Result);
             //var g1 = e.Current;

+ 5 - 5
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/GroupJoin.cs

@@ -68,7 +68,7 @@ namespace Tests
             var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -81,7 +81,7 @@ namespace Tests
             var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -94,7 +94,7 @@ namespace Tests
             var res = xs.GroupJoin(ys, x => { throw ex; }, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -107,7 +107,7 @@ namespace Tests
             var res = xs.GroupJoin(ys, x => x % 3, y => { throw ex; }, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -126,7 +126,7 @@ namespace Tests
 
             var e = res.GetAsyncEnumerator();
             await HasNextAsync(e, "0 - 36");
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
     }
 }

+ 5 - 5
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Join.cs

@@ -96,7 +96,7 @@ namespace Tests
             var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -109,7 +109,7 @@ namespace Tests
             var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -122,7 +122,7 @@ namespace Tests
             var res = xs.Join(ys, x => { throw ex; }, y => y, (x, y) => x + y);
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -135,7 +135,7 @@ namespace Tests
             var res = xs.Join(ys, x => x, y => { throw ex; }, (x, y) => x + y);
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -148,7 +148,7 @@ namespace Tests
             var res = xs.Join<int, int, int, int>(ys, x => x, y => y, (x, y) => { throw ex; });
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Last.cs

@@ -65,7 +65,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).Last();
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -73,7 +73,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).Last(x => true);
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/LastOrDefault.cs

@@ -65,7 +65,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).LastOrDefault();
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -73,7 +73,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).LastOrDefault(x => true);
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/LongCount.cs

@@ -46,7 +46,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount(new Func<int, bool>(x => { throw ex; }));
-            AssertThrows(() => ys.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(ys, ex);
         }
     }
 }

+ 4 - 4
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/OrderBy.cs

@@ -62,7 +62,7 @@ namespace Tests
             var ys = xs.OrderBy(new Func<int, int>(x => { throw ex; }));
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -82,7 +82,7 @@ namespace Tests
             var ys = xs.OrderBy(x => x).ThenBy(new Func<int, int>(x => { throw ex; }));
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -105,7 +105,7 @@ namespace Tests
             var ys = xs.OrderByDescending(new Func<int, int>(x => { throw ex; }));
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -125,7 +125,7 @@ namespace Tests
             var ys = xs.OrderBy(x => x).ThenByDescending(new Func<int, int>(x => { throw ex; }));
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs

@@ -60,7 +60,7 @@ namespace Tests
             var ys = xs.Reverse();
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]

+ 8 - 8
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SelectMany.cs

@@ -61,7 +61,7 @@ namespace Tests
             await HasNextAsync(e, 0);
             await HasNextAsync(e, 0);
             await HasNextAsync(e, 1);
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -72,7 +72,7 @@ namespace Tests
             var ys = xs.SelectMany(x => Enumerable.Range(0, x).ToAsyncEnumerable());
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -92,7 +92,7 @@ namespace Tests
             await HasNextAsync(e, 0);
             await HasNextAsync(e, 0);
             await HasNextAsync(e, 1);
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -128,7 +128,7 @@ namespace Tests
             await HasNextAsync(e, 0);
             await HasNextAsync(e, 0);
             await HasNextAsync(e, 1);
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -139,7 +139,7 @@ namespace Tests
             var ys = xs.SelectMany((x, i) => Enumerable.Range(0, x).ToAsyncEnumerable());
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -159,7 +159,7 @@ namespace Tests
             await HasNextAsync(e, 0);
             await HasNextAsync(e, 0);
             await HasNextAsync(e, 1);
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -211,7 +211,7 @@ namespace Tests
             await HasNextAsync(e, 6);
             await HasNextAsync(e, 8);
             await HasNextAsync(e, 9);
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -230,7 +230,7 @@ namespace Tests
             await HasNextAsync(e, 3);
             await HasNextAsync(e, 8);
             await HasNextAsync(e, 10);
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]

+ 4 - 4
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SequenceEqual.cs

@@ -80,7 +80,7 @@ namespace Tests
             var ys = Throw<int>(ex);
             var res = xs.SequenceEqual(ys);
 
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -91,7 +91,7 @@ namespace Tests
             var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
             var res = xs.SequenceEqual(ys);
 
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -145,7 +145,7 @@ namespace Tests
             var ys = Throw<int>(ex);
             var res = xs.SequenceEqual(ys, new Eq());
 
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -156,7 +156,7 @@ namespace Tests
             var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
             var res = xs.SequenceEqual(ys, new Eq());
 
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Single.cs

@@ -65,7 +65,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).Single();
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -73,7 +73,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).Single(x => true);
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SingleOrDefault.cs

@@ -65,7 +65,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).SingleOrDefault();
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]
@@ -73,7 +73,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).SingleOrDefault(x => true);
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs

@@ -72,7 +72,7 @@ namespace Tests
             var ys = xs.Skip(2);
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SkipWhile.cs

@@ -80,7 +80,7 @@ namespace Tests
             var ys = xs.SkipWhile(new Func<int, bool>(x => { throw ex; }));
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -127,7 +127,7 @@ namespace Tests
             var ys = xs.SkipWhile(new Func<int, int, bool>((x, i) => { throw ex; }));
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs

@@ -72,7 +72,7 @@ namespace Tests
             var ys = xs.Take(2);
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]

+ 2 - 2
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/TakeWhile.cs

@@ -77,7 +77,7 @@ namespace Tests
             var ys = xs.TakeWhile(new Func<int, bool>(x => { throw ex; }));
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -124,7 +124,7 @@ namespace Tests
             var ys = xs.TakeWhile(new Func<int, int, bool>((x, i) => { throw ex; }));
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
 

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToArray.cs

@@ -41,7 +41,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).ToArray();
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
 
         [Fact]

+ 1 - 1
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToList.cs

@@ -41,7 +41,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var res = Throw<int>(ex).ToList();
-            AssertThrows(() => res.Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(res, ex);
         }
     }
 }

+ 4 - 6
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Where.cs

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System;
-using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
 using Xunit;
@@ -61,7 +60,7 @@ namespace Tests
             await HasNextAsync(e, 8);
             await HasNextAsync(e, 5);
             await HasNextAsync(e, 7);
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -75,7 +74,7 @@ namespace Tests
             await HasNextAsync(e, 8);
             await HasNextAsync(e, 5);
             await HasNextAsync(e, 7);
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -86,7 +85,7 @@ namespace Tests
             var ys = xs.Where(x => true);
 
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -97,10 +96,9 @@ namespace Tests
 
             var ys = xs.Where((x, i) => true);
             var e = ys.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
-
         [Fact]
         public async Task Where7()
         {

+ 3 - 4
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Zip.cs

@@ -3,7 +3,6 @@
 // See the LICENSE file in the project root for more information. 
 
 using System;
-using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
 using Xunit;
@@ -71,7 +70,7 @@ namespace Tests
             var res = xs.Zip(ys, (x, y) => x * y);
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -83,7 +82,7 @@ namespace Tests
             var res = xs.Zip(ys, (x, y) => x * y);
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]
@@ -95,7 +94,7 @@ namespace Tests
             var res = xs.Zip(ys, (x, y) => { if (x > 0) throw ex; return x * y; });
 
             var e = res.GetAsyncEnumerator();
-            AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
+            AssertThrowsAsync(e.MoveNextAsync(), ex);
         }
 
         [Fact]