浏览代码

Hardening an Ix test where cancellation can bubble up.

Bart De Smet 10 年之前
父节点
当前提交
29dffab00a
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      Ix.NET/Source/Tests/AsyncTests.Creation.cs

+ 8 - 1
Ix.NET/Source/Tests/AsyncTests.Creation.cs

@@ -384,7 +384,14 @@ namespace Tests
             var t = e.MoveNext(cts.Token);
             cts.Cancel();
 
-            t.Wait();
+            try
+            {
+                t.Wait();
+            }
+            catch (AggregateException ex)
+            {
+                ex.Flatten().Handle(inner => inner is TaskCanceledException);
+            }
 
             Assert.IsTrue(disposed);
         }