Explorar o código

Minor test fixes.

Bart De Smet %!s(int64=7) %!d(string=hai) anos
pai
achega
af2829e5a4

+ 24 - 30
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/AsyncEnumerableTests.cs

@@ -19,27 +19,6 @@ namespace Tests
         private const int WaitTimeoutMs = 5000;
 
 #pragma warning disable xUnit1013 // Public method should be marked as test
-        public void AssertThrows<E>(Action a, Func<E, bool> assert)
-            where E : Exception
-        {
-            var hasFailed = false;
-
-            try
-            {
-                a();
-            }
-            catch (E e)
-            {
-                Assert.True(assert(e));
-                hasFailed = true;
-            }
-
-            if (!hasFailed)
-            {
-                Assert.True(false);
-            }
-        }
-
         public void AssertThrowsAsync<TException>(Task t)
         {
             AssertThrows<AggregateException>(() => t.Wait(WaitTimeoutMs), ex => ex.Flatten().InnerExceptions.Single() is TException);
@@ -76,16 +55,10 @@ namespace Tests
             await en1.DisposeAsync();
             await en2.DisposeAsync();
 
-            var e1t = enumerable.ToList();
-            var e2t = enumerable.ToList();
-
-            await Task.WhenAll(e1t, e2t);
-
+            var res1 = await enumerable.ToList();
+            var res2 = await enumerable.ToList();
 
-            var e1Result = e1t.Result;
-            var e2Result = e2t.Result;
-
-            e1Result.ShouldAllBeEquivalentTo(e2Result);
+            res1.ShouldAllBeEquivalentTo(res2);
         }
 #pragma warning restore xUnit1013 // Public method should be marked as test
 
@@ -109,5 +82,26 @@ namespace Tests
                     dispose: null)
             );
         }
+
+        private void AssertThrows<E>(Action a, Func<E, bool> assert)
+            where E : Exception
+        {
+            var hasFailed = false;
+
+            try
+            {
+                a();
+            }
+            catch (E e)
+            {
+                Assert.True(assert(e));
+                hasFailed = true;
+            }
+
+            if (!hasFailed)
+            {
+                Assert.True(false);
+            }
+        }
     }
 }

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

@@ -227,22 +227,6 @@ namespace Tests
             var e = ys.GetAsyncEnumerator();
 
             AssertThrowsAsync(e.MoveNextAsync(), ex);
-
-            //Assert.True(await e.MoveNext());
-            //var g1 = e.Current;
-            //Assert.Equal(g1.Key, 1);
-            //var g1e = g1.GetEnumerator();
-            //await HasNextAsync(g1e, 1);
-
-            //Assert.True(await e.MoveNext());
-            //var g2 = e.Current;
-            //Assert.Equal(g2.Key, 2);
-            //var g2e = g2.GetEnumerator();
-            //await HasNextAsync(g2e, 2);
-
-
-            //AssertThrows<Exception>(() => g1e.MoveNext().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
-            //AssertThrows<Exception>(() => g2e.MoveNext().Wait(WaitTimeoutMs), SingleInnerExceptionMatches(ex));
         }
 
         [Fact]

+ 0 - 2
Ix.NET/Source/System.Linq.Async.Tests/ValueTaskHelpers.cs

@@ -1,6 +1,4 @@
 using System;
-using System.Collections.Generic;
-using System.Text;
 using System.Threading.Tasks;
 using Xunit.Sdk;