Bladeren bron

Moving Cast and OfType tests.

Bart De Smet 8 jaren geleden
bovenliggende
commit
dc74fc7950

+ 0 - 47
Ix.NET/Source/System.Interactive.Async.Tests/AsyncTests.Single.cs

@@ -316,53 +316,6 @@ namespace Tests
             await SequenceIdentity(ys);
         }
 
-        [Fact]
-        public void OfType_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OfType<int>(null));
-        }
-
-        [Fact]
-        public void OfType()
-        {
-            var xs = new object[] { 1, 1.2, true, 4, "" }.ToAsyncEnumerable();
-            var ys = xs.OfType<int>();
-
-            var e = ys.GetAsyncEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Cast_Null()
-        {
-            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Cast<int>(null));
-        }
-
-        [Fact]
-        public void Cast1()
-        {
-            var xs = new object[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
-            var ys = xs.Cast<int>();
-
-            var e = ys.GetAsyncEnumerator();
-            HasNext(e, 1);
-            HasNext(e, 2);
-            HasNext(e, 3);
-            HasNext(e, 4);
-            NoNext(e);
-        }
-
-        [Fact]
-        public void Cast2()
-        {
-            var xs = new[] { new EventArgs(), new EventArgs(), new EventArgs() }.ToAsyncEnumerable();
-            var ys = xs.Cast<EventArgs>();
-
-            Assert.Same(xs, ys);
-        }
-
         [Fact]
         public void Do_Null()
         {

+ 42 - 0
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/Cast.cs

@@ -0,0 +1,42 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the Apache 2.0 License.
+// See the LICENSE file in the project root for more information. 
+
+using System;
+using System.Linq;
+using Xunit;
+
+namespace Tests
+{
+    public class Cast : AsyncEnumerableTests
+    {
+        [Fact]
+        public void Cast_Null()
+        {
+            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.Cast<int>(null));
+        }
+
+        [Fact]
+        public void Cast1()
+        {
+            var xs = new object[] { 1, 2, 3, 4 }.ToAsyncEnumerable();
+            var ys = xs.Cast<int>();
+
+            var e = ys.GetAsyncEnumerator();
+            HasNext(e, 1);
+            HasNext(e, 2);
+            HasNext(e, 3);
+            HasNext(e, 4);
+            NoNext(e);
+        }
+
+        [Fact]
+        public void Cast2()
+        {
+            var xs = new[] { new EventArgs(), new EventArgs(), new EventArgs() }.ToAsyncEnumerable();
+            var ys = xs.Cast<EventArgs>();
+
+            Assert.Same(xs, ys);
+        }
+    }
+}

+ 31 - 0
Ix.NET/Source/System.Linq.Async.Tests/System/Linq/Operators/OfType.cs

@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the Apache 2.0 License.
+// See the LICENSE file in the project root for more information. 
+
+using System;
+using System.Linq;
+using Xunit;
+
+namespace Tests
+{
+    public class OfType : AsyncEnumerableTests
+    {
+        [Fact]
+        public void OfType_Null()
+        {
+            AssertThrows<ArgumentNullException>(() => AsyncEnumerable.OfType<int>(null));
+        }
+
+        [Fact]
+        public void OfType1()
+        {
+            var xs = new object[] { 1, 1.2, true, 4, "" }.ToAsyncEnumerable();
+            var ys = xs.OfType<int>();
+
+            var e = ys.GetAsyncEnumerator();
+            HasNext(e, 1);
+            HasNext(e, 4);
+            NoNext(e);
+        }
+    }
+}