Ver Fonte

Add tests for optimized reverse

Oren Novotny há 9 anos atrás
pai
commit
6a44604187
1 ficheiros alterados com 27 adições e 0 exclusões
  1. 27 0
      Ix.NET/Source/Tests/AsyncTests.Single.cs

+ 27 - 0
Ix.NET/Source/Tests/AsyncTests.Single.cs

@@ -1341,6 +1341,33 @@ namespace Tests
             AssertThrows<Exception>(() => e.MoveNext().Wait(WaitTimeoutMs), ex_ => ((AggregateException)ex_).Flatten().InnerExceptions.Single() == ex);
         }
 
+        [Fact]
+        public async Task Reverse5()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = xs.Reverse();
+
+            Assert.Equal(new[] { 3, 2, 1 }, await ys.ToArray());
+        }
+
+        [Fact]
+        public async Task Reverse6()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = xs.Reverse();
+
+            Assert.Equal(new[] { 3, 2, 1 }, await ys.ToList());
+        }
+
+        [Fact]
+        public async Task Reverse7()
+        {
+            var xs = new[] { 1, 2, 3 }.ToAsyncEnumerable();
+            var ys = xs.Reverse();
+
+            Assert.Equal(3, await ys.Count());
+        }
+
         [Fact]
         public void OrderBy_Null()
         {