浏览代码

Reducing the number of references to Throw.

Bart De Smet 8 年之前
父节点
当前提交
e430df5c58
共有 41 个文件被更改,包括 79 次插入77 次删除
  1. 1 0
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/AsyncEnumerableExTests.cs
  2. 10 10
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Catch.cs
  3. 2 2
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Do.cs
  4. 1 1
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Finally.cs
  5. 1 1
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/IgnoreElements.cs
  6. 1 1
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/MaxBy.cs
  7. 1 1
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/MinBy.cs
  8. 4 4
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/OnErrorResumeNext.cs
  9. 1 1
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Retry.cs
  10. 1 1
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/StartWith.cs
  11. 1 1
      Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Using.cs
  12. 1 0
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/AsyncEnumerableTests.cs
  13. 3 3
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Aggregate.cs
  14. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/All.cs
  15. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Any.cs
  16. 3 3
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Concat.cs
  17. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Count.cs
  18. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/DefaultIfEmpty.cs
  19. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ElementAt.cs
  20. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ElementAtOrDefault.cs
  21. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/First.cs
  22. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/FirstOrDefault.cs
  23. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ForEachAsync.cs
  24. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/GroupBy.cs
  25. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/GroupJoin.cs
  26. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Join.cs
  27. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Last.cs
  28. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/LastOrDefault.cs
  29. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/LongCount.cs
  30. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Reverse.cs
  31. 4 4
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SelectMany.cs
  32. 4 4
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SequenceEqual.cs
  33. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Single.cs
  34. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/SingleOrDefault.cs
  35. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Skip.cs
  36. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Take.cs
  37. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Throw.cs
  38. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToArray.cs
  39. 1 1
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/ToList.cs
  40. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Where.cs
  41. 2 2
      Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Zip.cs

+ 1 - 0
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/AsyncEnumerableExTests.cs

@@ -14,6 +14,7 @@ namespace Tests
     public class AsyncEnumerableExTests
     {
         protected static readonly IAsyncEnumerable<int> Return42 = AsyncEnumerable.Return(42);
+        protected static IAsyncEnumerable<T> Throw<T>(Exception exception) => AsyncEnumerable.Throw<T>(exception);
 
         protected const int WaitTimeoutMs = 5000;
 

+ 10 - 10
Ix.NET/Source/System.Interactive.Async.Tests/System/Linq/Operators/Catch.cs

@@ -48,7 +48,7 @@ namespace Tests
             var ex = new InvalidOperationException("Bang!");
 
             var err = false;
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
             var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
 
             var res = xs.Catch<int, InvalidOperationException>(ex_ => { err = true; return ys; });
@@ -75,7 +75,7 @@ namespace Tests
             var ex = new InvalidOperationException("Bang!");
 
             var err = false;
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
             var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
 
             var res = xs.Catch<int, Exception>(ex_ => { err = true; return ys; });
@@ -102,7 +102,7 @@ namespace Tests
             var ex = new DivideByZeroException();
 
             var err = false;
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
             var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
 
             var res = xs.Catch<int, InvalidOperationException>(ex_ => { err = true; return ys; });
@@ -123,7 +123,7 @@ namespace Tests
             var ex = new InvalidOperationException("Bang!");
             var ex2 = new Exception("Oops!");
 
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
             var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
 
             var res = xs.Catch<int, InvalidOperationException>(ex_ => { if (ex_.Message == "Bang!") throw ex2; return ys; });
@@ -142,7 +142,7 @@ namespace Tests
             var ex = new InvalidOperationException("Bang!");
 
             var err = false;
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
 
             var res = xs.Catch<int, InvalidOperationException>(ex_ => { err = true; return xs; });
 
@@ -183,7 +183,7 @@ namespace Tests
         {
             var ex = new InvalidOperationException("Bang!");
 
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
             var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
 
             var res = AsyncEnumerableEx.Catch(xs, ys);
@@ -203,7 +203,7 @@ namespace Tests
         {
             var ex = new InvalidOperationException("Bang!");
 
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
             var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
 
             var res = AsyncEnumerableEx.Catch(new[] { xs, xs, ys, ys });
@@ -236,7 +236,7 @@ namespace Tests
 
         private IEnumerable<IAsyncEnumerable<int>> CatchXss()
         {
-            yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(new Exception("!!!")));
+            yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(new Exception("!!!")));
             throw new Exception("Bang!");
         }
 
@@ -245,7 +245,7 @@ namespace Tests
         {
             var ex = new InvalidOperationException("Bang!");
 
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
 
             var res = AsyncEnumerableEx.Catch(new[] { xs, xs });
 
@@ -274,7 +274,7 @@ namespace Tests
         {
             var ex = new InvalidOperationException("Bang!");
 
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
             var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
 
             var res = AsyncEnumerableEx.Catch(new[] { xs, xs, ys, ys });

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

@@ -118,7 +118,7 @@ namespace Tests
             var exa = default(Exception);
             var done = false;
             var hasv = false;
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = xs.Do(x => { hasv = true; }, exx => { exa = exx; }, () => { done = true; });
 
             var e = ys.GetAsyncEnumerator();
@@ -135,7 +135,7 @@ namespace Tests
             var ex = new Exception("Bang");
             var exa = default(Exception);
             var hasv = false;
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = xs.Do(x => { hasv = true; }, exx => { exa = exx; });
 
             var e = ys.GetAsyncEnumerator();

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

@@ -59,7 +59,7 @@ namespace Tests
 
             var b = false;
 
-            var xs = AsyncEnumerable.Throw<int>(ex).Finally(() => { b = true; });
+            var xs = Throw<int>(ex).Finally(() => { b = true; });
 
             var e = xs.GetAsyncEnumerator();
 

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

@@ -55,7 +55,7 @@ namespace Tests
         public void IgnoreElements4()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex).IgnoreElements();
+            var xs = Throw<int>(ex).IgnoreElements();
 
             var e = xs.GetAsyncEnumerator();
             AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), (Exception ex_) => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);

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

@@ -70,7 +70,7 @@ namespace Tests
         public void MaxBy5()
         {
             var ex = new Exception("Bang!");
-            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex)).MaxBy(x => x, Comparer<int>.Default);
+            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(Throw<int>(ex)).MaxBy(x => x, Comparer<int>.Default);
 
             AssertThrows<Exception>(() => xs.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }

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

@@ -70,7 +70,7 @@ namespace Tests
         public void MinBy5()
         {
             var ex = new Exception("Bang!");
-            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex)).MinBy(x => x, Comparer<int>.Default);
+            var xs = new[] { 3, 5, 7, 6, 4, 2 }.ToAsyncEnumerable().Concat(Throw<int>(ex)).MinBy(x => x, Comparer<int>.Default);
 
             AssertThrows<Exception>(() => xs.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }

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

@@ -44,7 +44,7 @@ namespace Tests
         {
             var ex = new InvalidOperationException("Bang!");
 
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
             var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
 
             var res = AsyncEnumerableEx.OnErrorResumeNext(xs, ys);
@@ -64,7 +64,7 @@ namespace Tests
         {
             var ex = new InvalidOperationException("Bang!");
 
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
             var ys = new[] { 4, 5, 6 }.ToAsyncEnumerable();
 
             var res = AsyncEnumerableEx.OnErrorResumeNext(new[] { xs, xs, ys, ys });
@@ -100,7 +100,7 @@ namespace Tests
 
         private IEnumerable<IAsyncEnumerable<int>> OnErrorResumeNextXss()
         {
-            yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(new Exception("!!!")));
+            yield return new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(new Exception("!!!")));
             throw new Exception("Bang!");
         }
 
@@ -109,7 +109,7 @@ namespace Tests
         {
             var ex = new InvalidOperationException("Bang!");
 
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
 
             var res = AsyncEnumerableEx.OnErrorResumeNext(new[] { xs, xs });
 

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

@@ -39,7 +39,7 @@ namespace Tests
         {
             var ex = new InvalidOperationException("Bang!");
 
-            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
 
             var res = xs.Retry();
 

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

@@ -45,7 +45,7 @@ namespace Tests
         public void StartWith3()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex).StartWith(1, 2);
+            var xs = Throw<int>(ex).StartWith(1, 2);
 
             var e = xs.GetAsyncEnumerator();
             HasNext(e, 1);

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

@@ -126,7 +126,7 @@ namespace Tests
                     i++;
                     return new MyD(() => { disposed.TrySetResult(true); });
                 },
-                _ => AsyncEnumerable.Throw<int>(ex)
+                _ => Throw<int>(ex)
             );
 
             Assert.Equal(0, i);

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

@@ -14,6 +14,7 @@ namespace Tests
     public class AsyncEnumerableTests
     {
         protected static readonly IAsyncEnumerable<int> Return42 = AsyncEnumerable.Return(42);
+        protected static IAsyncEnumerable<T> Throw<T>(Exception exception) => AsyncEnumerable.Throw<T>(exception);
 
         protected const int WaitTimeoutMs = 5000;
 

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

@@ -57,7 +57,7 @@ namespace Tests
         public void Aggregate3()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            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);
         }
@@ -91,7 +91,7 @@ namespace Tests
         public void Aggregate7()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            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);
         }
@@ -125,7 +125,7 @@ namespace Tests
         public void Aggregate11()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            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);
         }

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

@@ -41,7 +41,7 @@ namespace Tests
         public void All3()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).All(x => x % 2 == 0);
+            var res = Throw<int>(ex).All(x => x % 2 == 0);
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 

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

@@ -43,7 +43,7 @@ namespace Tests
         public void Any3()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).Any(x => x % 2 == 0);
+            var res = Throw<int>(ex).Any(x => x % 2 == 0);
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 

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

@@ -40,7 +40,7 @@ namespace Tests
         public void Concat2()
         {
             var ex = new Exception("Bang");
-            var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(AsyncEnumerable.Throw<int>(ex));
+            var ys = new[] { 1, 2, 3 }.ToAsyncEnumerable().Concat(Throw<int>(ex));
 
             var e = ys.GetAsyncEnumerator();
             HasNext(e, 1);
@@ -53,7 +53,7 @@ namespace Tests
         public void Concat3()
         {
             var ex = new Exception("Bang");
-            var ys = AsyncEnumerable.Throw<int>(ex).Concat(new[] { 4, 5, 6 }.ToAsyncEnumerable());
+            var ys = Throw<int>(ex).Concat(new[] { 4, 5, 6 }.ToAsyncEnumerable());
 
             var e = ys.GetAsyncEnumerator();
             AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), (Exception ex_) => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
@@ -86,7 +86,7 @@ namespace Tests
             var ex = new Exception("Bang");
             var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
             var ys = new[] { 4, 5 }.ToAsyncEnumerable();
-            var zs = AsyncEnumerable.Throw<int>(ex);
+            var zs = Throw<int>(ex);
 
             var res = AsyncEnumerable.Concat(xs, ys, zs);
 

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

@@ -30,7 +30,7 @@ namespace Tests
         {
             Assert.Equal(0, new int[0].ToAsyncEnumerable().Count().Result);
             Assert.Equal(3, new[] { 1, 2, 3 }.ToAsyncEnumerable().Count().Result);
-            AssertThrows<AggregateException>(() => AsyncEnumerable.Throw<int>(new Exception("Bang!")).Count().Wait(WaitTimeoutMs));
+            AssertThrows<AggregateException>(() => Throw<int>(new Exception("Bang!")).Count().Wait(WaitTimeoutMs));
         }
 
         [Fact]
@@ -38,7 +38,7 @@ namespace Tests
         {
             Assert.Equal(0, new int[0].ToAsyncEnumerable().Count(x => x < 3).Result);
             Assert.Equal(2, new[] { 1, 2, 3 }.ToAsyncEnumerable().Count(x => x < 3).Result);
-            AssertThrows<AggregateException>(() => AsyncEnumerable.Throw<int>(new Exception("Bang!")).Count(x => x < 3).Wait(WaitTimeoutMs));
+            AssertThrows<AggregateException>(() => Throw<int>(new Exception("Bang!")).Count(x => x < 3).Wait(WaitTimeoutMs));
         }
 
         [Fact]

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

@@ -89,7 +89,7 @@ namespace Tests
         public void DefaultIfEmpty7()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex).DefaultIfEmpty();
+            var xs = Throw<int>(ex).DefaultIfEmpty();
 
             var e = xs.GetAsyncEnumerator();
             AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), (Exception ex_) => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
@@ -99,7 +99,7 @@ namespace Tests
         public void DefaultIfEmpty8()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex).DefaultIfEmpty(24);
+            var xs = Throw<int>(ex).DefaultIfEmpty(24);
 
             var e = xs.GetAsyncEnumerator();
             AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), (Exception ex_) => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);

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

@@ -62,7 +62,7 @@ namespace Tests
         public void ElementAt6()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).ElementAt(15);
+            var res = Throw<int>(ex).ElementAt(15);
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
     }

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

@@ -62,7 +62,7 @@ namespace Tests
         public void ElementAtOrDefault6()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).ElementAtOrDefault(15);
+            var res = Throw<int>(ex).ElementAtOrDefault(15);
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
     }

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

@@ -64,7 +64,7 @@ namespace Tests
         public void First6()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).First();
+            var res = Throw<int>(ex).First();
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 
@@ -72,7 +72,7 @@ namespace Tests
         public void First7()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).First(x => true);
+            var res = Throw<int>(ex).First(x => true);
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 

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

@@ -64,7 +64,7 @@ namespace Tests
         public void FirstOrDefault6()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).FirstOrDefault();
+            var res = Throw<int>(ex).FirstOrDefault();
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 
@@ -72,7 +72,7 @@ namespace Tests
         public void FirstOrDefault7()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).FirstOrDefault(x => true);
+            var res = Throw<int>(ex).FirstOrDefault(x => true);
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 

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

@@ -69,7 +69,7 @@ namespace Tests
         public void ForEachAsync5()
         {
             var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
 
             AssertThrows<Exception>(() => xs.ForEachAsync(x => { throw ex; }).Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
@@ -78,7 +78,7 @@ namespace Tests
         public void ForEachAsync6()
         {
             var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
 
             AssertThrows<Exception>(() => xs.ForEachAsync((x, i) => { throw ex; }).Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }

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

@@ -172,7 +172,7 @@ namespace Tests
         public void GroupBy4()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = xs.GroupBy(x => x);
 
             var e = ys.GetAsyncEnumerator();

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

@@ -62,7 +62,7 @@ namespace Tests
         public void GroupJoin3()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = new[] { 3, 6, 4 }.ToAsyncEnumerable();
 
             var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
@@ -76,7 +76,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = AsyncEnumerable.Throw<int>(ex);
+            var ys = Throw<int>(ex);
 
             var res = xs.GroupJoin(ys, x => x % 3, y => y % 3, (x, i) => x + " - " + i.Aggregate("", (s, j) => s + j).Result);
 

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

@@ -91,7 +91,7 @@ namespace Tests
         public void Join5()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = new[] { 0, 1, 2 }.ToAsyncEnumerable();
 
             var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
@@ -105,7 +105,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var xs = new[] { 0, 1, 2 }.ToAsyncEnumerable();
-            var ys = AsyncEnumerable.Throw<int>(ex);
+            var ys = Throw<int>(ex);
 
             var res = xs.Join(ys, x => x % 3, y => y % 3, (x, y) => x + y);
 

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

@@ -64,7 +64,7 @@ namespace Tests
         public void Last6()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).Last();
+            var res = Throw<int>(ex).Last();
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 
@@ -72,7 +72,7 @@ namespace Tests
         public void Last7()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).Last(x => true);
+            var res = Throw<int>(ex).Last(x => true);
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 

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

@@ -64,7 +64,7 @@ namespace Tests
         public void LastOrDefault6()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).LastOrDefault();
+            var res = Throw<int>(ex).LastOrDefault();
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 
@@ -72,7 +72,7 @@ namespace Tests
         public void LastOrDefault7()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).LastOrDefault(x => true);
+            var res = Throw<int>(ex).LastOrDefault(x => true);
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 

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

@@ -30,7 +30,7 @@ namespace Tests
         {
             Assert.Equal(0, new int[0].ToAsyncEnumerable().LongCount().Result);
             Assert.Equal(3, new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount().Result);
-            AssertThrows<AggregateException>(() => AsyncEnumerable.Throw<int>(new Exception("Bang!")).LongCount().Wait(WaitTimeoutMs));
+            AssertThrows<AggregateException>(() => Throw<int>(new Exception("Bang!")).LongCount().Wait(WaitTimeoutMs));
         }
 
         [Fact]
@@ -38,7 +38,7 @@ namespace Tests
         {
             Assert.Equal(0, new int[0].ToAsyncEnumerable().LongCount(x => x < 3).Result);
             Assert.Equal(2, new[] { 1, 2, 3 }.ToAsyncEnumerable().LongCount(x => x < 3).Result);
-            AssertThrows<AggregateException>(() => AsyncEnumerable.Throw<int>(new Exception("Bang!")).LongCount(x => x < 3).Wait(WaitTimeoutMs));
+            AssertThrows<AggregateException>(() => Throw<int>(new Exception("Bang!")).LongCount(x => x < 3).Wait(WaitTimeoutMs));
         }
 
         [Fact]

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

@@ -56,7 +56,7 @@ namespace Tests
         public void Reverse4()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = xs.Reverse();
 
             var e = ys.GetAsyncEnumerator();

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

@@ -54,7 +54,7 @@ namespace Tests
                 if (x < 3)
                     return Enumerable.Range(0, x).ToAsyncEnumerable();
                 else
-                    return AsyncEnumerable.Throw<int>(ex);
+                    return Throw<int>(ex);
             });
 
             var e = ys.GetAsyncEnumerator();
@@ -68,7 +68,7 @@ namespace Tests
         public void SelectMany3()
         {
             var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = xs.SelectMany(x => Enumerable.Range(0, x).ToAsyncEnumerable());
 
             var e = ys.GetAsyncEnumerator();
@@ -121,7 +121,7 @@ namespace Tests
                 if (i < 2)
                     return Enumerable.Range(0, x).ToAsyncEnumerable();
                 else
-                    return AsyncEnumerable.Throw<int>(ex);
+                    return Throw<int>(ex);
             });
 
             var e = ys.GetAsyncEnumerator();
@@ -135,7 +135,7 @@ namespace Tests
         public void SelectMany7()
         {
             var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = xs.SelectMany((x, i) => Enumerable.Range(0, x).ToAsyncEnumerable());
 
             var e = ys.GetAsyncEnumerator();

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

@@ -79,7 +79,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = AsyncEnumerable.Throw<int>(ex);
+            var ys = Throw<int>(ex);
             var res = xs.SequenceEqual(ys);
 
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
@@ -89,7 +89,7 @@ namespace Tests
         public void SequenceEqual7()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
             var res = xs.SequenceEqual(ys);
 
@@ -144,7 +144,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = AsyncEnumerable.Throw<int>(ex);
+            var ys = Throw<int>(ex);
             var res = xs.SequenceEqual(ys, new Eq());
 
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
@@ -154,7 +154,7 @@ namespace Tests
         public void SequenceEqual14()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
             var res = xs.SequenceEqual(ys, new Eq());
 

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

@@ -64,7 +64,7 @@ namespace Tests
         public void Single6()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).Single();
+            var res = Throw<int>(ex).Single();
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 
@@ -72,7 +72,7 @@ namespace Tests
         public void Single7()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).Single(x => true);
+            var res = Throw<int>(ex).Single(x => true);
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 

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

@@ -64,7 +64,7 @@ namespace Tests
         public void SingleOrDefault6()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).SingleOrDefault();
+            var res = Throw<int>(ex).SingleOrDefault();
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 
@@ -72,7 +72,7 @@ namespace Tests
         public void SingleOrDefault7()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).SingleOrDefault(x => true);
+            var res = Throw<int>(ex).SingleOrDefault(x => true);
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 

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

@@ -68,7 +68,7 @@ namespace Tests
         public void Skip4()
         {
             var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = xs.Skip(2);
 
             var e = ys.GetAsyncEnumerator();

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

@@ -68,7 +68,7 @@ namespace Tests
         public void Take4()
         {
             var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = xs.Take(2);
 
             var e = ys.GetAsyncEnumerator();

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

@@ -13,14 +13,14 @@ namespace Tests
         [Fact]
         public void Throw_Null()
         {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Throw<int>(default(Exception)));
+            AssertThrows<ArgumentNullException>(() => Throw<int>(default(Exception)));
         }
 
         [Fact]
         public void Throw1()
         {
             var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
 
             var e = xs.GetAsyncEnumerator();
             AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), (Exception ex_) => ((AggregateException)ex_).InnerExceptions.Single() == ex);

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

@@ -40,7 +40,7 @@ namespace Tests
         public void ToArray3()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).ToArray();
+            var res = Throw<int>(ex).ToArray();
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 

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

@@ -40,7 +40,7 @@ namespace Tests
         public void ToList3()
         {
             var ex = new Exception("Bang!");
-            var res = AsyncEnumerable.Throw<int>(ex).ToList();
+            var res = Throw<int>(ex).ToList();
             AssertThrows<Exception>(() => res.Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
     }

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

@@ -82,7 +82,7 @@ namespace Tests
         public void Where5()
         {
             var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = xs.Where(x => true);
 
             var e = ys.GetAsyncEnumerator();
@@ -93,7 +93,7 @@ namespace Tests
         public void Where6()
         {
             var ex = new Exception("Bang");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
 
             var ys = xs.Where((x, i) => true);
             var e = ys.GetAsyncEnumerator();

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

@@ -67,7 +67,7 @@ namespace Tests
         {
             var ex = new Exception("Bang!");
             var xs = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = AsyncEnumerable.Throw<int>(ex);
+            var ys = Throw<int>(ex);
             var res = xs.Zip(ys, (x, y) => x * y);
 
             var e = res.GetAsyncEnumerator();
@@ -78,7 +78,7 @@ namespace Tests
         public void Zip5()
         {
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Throw<int>(ex);
+            var xs = Throw<int>(ex);
             var ys = new[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
             var res = xs.Zip(ys, (x, y) => x * y);