Add another Task test
authorMarek Safar <marek.safar@gmail.com>
Tue, 29 May 2012 09:33:21 +0000 (10:33 +0100)
committerMarek Safar <marek.safar@gmail.com>
Tue, 29 May 2012 15:13:45 +0000 (16:13 +0100)
mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs

index 95a19c46e03a7f772173060c17667ba68d58257d..060b2585148de4216bf57aba9009106bb81f3869 100644 (file)
@@ -1,7 +1,11 @@
 //
 // TaskTest.cs
 //
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
 // Copyright (c) 2008 Jérémie "Garuma" Laval
+// Copyright (C) 2011 Xamarin Inc (http://www.xamarin.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
@@ -303,6 +307,15 @@ namespace MonoTests.System.Threading.Tasks
                        Assert.IsTrue (tasks[0].IsCompleted, "#3");
                        Assert.IsTrue (tasks[1].IsCanceled, "#4");
                }
+               
+               [Test]
+               public void WaitAll_CancelledAndTimeout ()
+               {
+                       var ct = new CancellationToken (true);
+                       var t1 = new Task (() => {}, ct);
+                       var t2 = Task.Delay (3000);
+                       Assert.IsFalse (Task.WaitAll (new[] { t1, t2 }, 10));
+               }
 
                [Test]
                public void WaitAllExceptionThenCancelled ()