Merge pull request #3796 from ntherning/windows-backend-for-MemoryMappedFile
[mono.git] / mcs / class / corlib / Test / System.Threading.Tasks / TaskFactoryTest_T.cs
index ff964bb9cfcc65e348b234958455b37394d8e901..803b10c15eb9d4384b89465ad77d1d190bde275e 100644 (file)
 //
 //
 
-#if NET_4_0
 
 using System;
 using System.Threading;
 using System.Threading.Tasks;
 
 using NUnit.Framework;
-#if !MOBILE
-using NUnit.Framework.SyntaxHelpers;
-#endif
 
 namespace MonoTests.System.Threading.Tasks
 {
@@ -265,17 +261,15 @@ namespace MonoTests.System.Threading.Tasks
                        } catch (InvalidOperationException) {
                        }
 
-                       Assert.IsTrue (task.IsCanceled, "#2");
-
-                       task = factory.StartNew (() => 1, ct);
                        try {
                                task.Wait ();
+                               Assert.Fail ("#2");
                        } catch (AggregateException e) {
-                               Assert.IsTrue (task.IsCanceled, "#3");
-                               Assert.That (e.InnerException, Is.TypeOf (typeof (TaskCanceledException)), "#4");
+                               Assert.That (e.InnerException, Is.TypeOf (typeof (TaskCanceledException)), "#3");
                        }
+
+                       Assert.IsTrue (task.IsCanceled, "#4");
                }
        }
 }
 
-#endif