浏览代码

Remove unnecessary TaskExt.

Bart De Smet 7 年之前
父节点
当前提交
61dba5ec56

+ 0 - 1
Ix.NET/Source/System.Interactive.Async.Tests/System.Interactive.Async.Tests.csproj

@@ -28,7 +28,6 @@
 
   <ItemGroup>
     <Compile Include="..\System.Linq.Async.Tests\ValueTaskHelpers.cs" />
-    <Compile Include="..\System.Linq.Async.Tests\TaskExt.cs" />
   </ItemGroup>
 
   <ItemGroup>

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

@@ -15,13 +15,13 @@ namespace Tests
         [Fact]
         public void CreateEnumerator_Null()
         {
-            Assert.Throws<ArgumentNullException>(() => AsyncEnumerable.CreateEnumerator(default, () => 3, () => TaskExt.CompletedTask));
+            Assert.Throws<ArgumentNullException>(() => AsyncEnumerable.CreateEnumerator(default, () => 3, () => new ValueTask()));
         }
 
         [Fact]
         public void CreateEnumerator_Throws()
         {
-            var iter = AsyncEnumerable.CreateEnumerator(() => TaskExt.True, () => 3, () => TaskExt.CompletedTask);
+            var iter = AsyncEnumerable.CreateEnumerator(() => new ValueTask<bool>(false), () => 3, () => new ValueTask());
 
             var enu = (IAsyncEnumerable<int>)iter;
 

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

@@ -143,9 +143,9 @@ namespace Tests
 
             var ae = AsyncEnumerable.CreateEnumerable(
                 _ => AsyncEnumerable.CreateEnumerator<int>(
-                    () => TaskExt.False,
+                    () => new ValueTask<bool>(false),
                     () => { throw new InvalidOperationException(); },
-                    () => { evt.Set(); return TaskExt.CompletedTask; }));
+                    () => { evt.Set(); return default; }));
 
             ae
                 .ToObservable()
@@ -186,7 +186,7 @@ namespace Tests
                     () =>
                     {
                         evt.Set();
-                        return TaskExt.CompletedTask;
+                        return default;
                     }));
 
             subscription = ae
@@ -234,7 +234,7 @@ namespace Tests
                     () =>
                     {
                         evt.Set();
-                        return TaskExt.CompletedTask;
+                        return default;
                     }));
 
             subscription = ae

+ 0 - 14
Ix.NET/Source/System.Linq.Async.Tests/TaskExt.cs

@@ -1,14 +0,0 @@
-// 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. 
-
-namespace System.Threading.Tasks
-{
-    internal static class TaskExt
-    {
-        public static readonly ValueTask<bool> True = new ValueTask<bool>(true);
-        public static readonly ValueTask<bool> False = new ValueTask<bool>(false);
-        public static readonly ValueTask CompletedTask = new ValueTask(Task.FromResult(true));
-        public static readonly ValueTask<bool> Never = new ValueTask<bool>(new TaskCompletionSource<bool>().Task);
-    }
-}