Bläddra i källkod

Moving Generate to AsyncEnumerableEx.

Bart De Smet 8 år sedan
förälder
incheckning
1a68655592

+ 8 - 8
Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Creation.cs

@@ -203,15 +203,15 @@ namespace Tests
         [Fact]
         [Fact]
         public void Generate_Null()
         public void Generate_Null()
         {
         {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Generate<int, int>(0, null, x => x, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Generate<int, int>(0, x => true, null, x => x));
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Generate<int, int>(0, x => true, x => x, null));
+            AssertThrows<ArgumentNullException>(() => AsyncEnumerableEx.Generate<int, int>(0, null, x => x, x => x));
+            AssertThrows<ArgumentNullException>(() => AsyncEnumerableEx.Generate<int, int>(0, x => true, null, x => x));
+            AssertThrows<ArgumentNullException>(() => AsyncEnumerableEx.Generate<int, int>(0, x => true, x => x, null));
         }
         }
 
 
         [Fact]
         [Fact]
         public async Task Generate1()
         public async Task Generate1()
         {
         {
-            var xs = AsyncEnumerable.Generate(0, x => x < 5, x => x + 1, x => x * x);
+            var xs = AsyncEnumerableEx.Generate(0, x => x < 5, x => x + 1, x => x * x);
 
 
             var e = xs.GetAsyncEnumerator();
             var e = xs.GetAsyncEnumerator();
             HasNext(e, 0);
             HasNext(e, 0);
@@ -227,7 +227,7 @@ namespace Tests
         public void Generate2()
         public void Generate2()
         {
         {
             var ex = new Exception("Bang!");
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Generate(0, x => { throw ex; }, x => x + 1, x => x * x);
+            var xs = AsyncEnumerableEx.Generate(0, x => { throw ex; }, x => x + 1, x => x * x);
 
 
             var e = xs.GetAsyncEnumerator();
             var e = xs.GetAsyncEnumerator();
             AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), (Exception ex_) => ((AggregateException)ex_).InnerExceptions.Single() == ex);
             AssertThrows(() => e.MoveNextAsync().Wait(WaitTimeoutMs), (Exception ex_) => ((AggregateException)ex_).InnerExceptions.Single() == ex);
@@ -237,7 +237,7 @@ namespace Tests
         public void Generate3()
         public void Generate3()
         {
         {
             var ex = new Exception("Bang!");
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Generate(0, x => true, x => x + 1, x => { if (x == 1) throw ex; return x * x; });
+            var xs = AsyncEnumerableEx.Generate(0, x => true, x => x + 1, x => { if (x == 1) throw ex; return x * x; });
 
 
             var e = xs.GetAsyncEnumerator();
             var e = xs.GetAsyncEnumerator();
             HasNext(e, 0);
             HasNext(e, 0);
@@ -248,7 +248,7 @@ namespace Tests
         public void Generate4()
         public void Generate4()
         {
         {
             var ex = new Exception("Bang!");
             var ex = new Exception("Bang!");
-            var xs = AsyncEnumerable.Generate(0, x => true, x => { throw ex; }, x => x * x);
+            var xs = AsyncEnumerableEx.Generate(0, x => true, x => { throw ex; }, x => x * x);
 
 
             var e = xs.GetAsyncEnumerator();
             var e = xs.GetAsyncEnumerator();
             HasNext(e, 0);
             HasNext(e, 0);
@@ -258,7 +258,7 @@ namespace Tests
         [Fact]
         [Fact]
         public async Task Generate5()
         public async Task Generate5()
         {
         {
-            var xs = AsyncEnumerable.Generate(0, x => x < 5, x => x + 1, x => x * x);
+            var xs = AsyncEnumerableEx.Generate(0, x => x < 5, x => x + 1, x => x * x);
 
 
             await SequenceIdentity(xs);
             await SequenceIdentity(xs);
         }
         }

+ 1 - 1
Ix.NET/Source/System.Interactive.Async.Tests/TaskExtTests.cs

@@ -39,7 +39,7 @@ namespace Tests
         {
         {
             try
             try
             {
             {
-                var asyncEnumerable = AsyncEnumerable.Generate(15, (x) => { throw new InvalidOperationException(); }, (x) => { return 20; }, (x) => { return 2; });
+                var asyncEnumerable = AsyncEnumerableEx.Generate(15, (x) => { throw new InvalidOperationException(); }, (x) => { return 20; }, (x) => { return 2; });
                 await asyncEnumerable.ToArray();
                 await asyncEnumerable.ToArray();
             }
             }
             catch (AggregateException)
             catch (AggregateException)

+ 1 - 1
Ix.NET/Source/System.Interactive.Async/Generate.cs → Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Generate.cs

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 
 
 namespace System.Linq
 namespace System.Linq
 {
 {
-    public static partial class AsyncEnumerable
+    public static partial class AsyncEnumerableEx
     {
     {
         public static IAsyncEnumerable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector)
         public static IAsyncEnumerable<TResult> Generate<TState, TResult>(TState initialState, Func<TState, bool> condition, Func<TState, TState> iterate, Func<TState, TResult> resultSelector)
         {
         {