Merge pull request #799 from kebby/master
[mono.git] / mcs / class / corlib / Test / System.Threading.Tasks / TaskTest.cs
index feff0e8b06f234afa871dfb8c18570b201ba566a..f61a64d4aa0f89fceb29833e418b9910cafabce2 100644 (file)
@@ -1149,6 +1149,16 @@ namespace MonoTests.System.Threading.Tasks
                        }
                }
 
+               [Test]
+               public void WhenAll_Empty ()
+               {
+                       var tasks = new Task[0];
+
+                       Task t = Task.WhenAll(tasks);
+
+                       Assert.IsTrue(t.Wait(1000), "#1");
+               }
+
                [Test]
                public void WhenAll_WithNull ()
                {
@@ -1274,6 +1284,18 @@ namespace MonoTests.System.Threading.Tasks
                        Assert.IsTrue (t.Wait (1000), "#2");
                }
 
+               [Test]
+               public void WhenAllResult_Empty ()
+               {
+                       var tasks = new Task<int>[0];
+
+                       Task<int[]> t = Task.WhenAll(tasks);
+
+                       Assert.IsTrue(t.Wait(1000), "#1");
+                       Assert.IsNotNull(t.Result, "#2");
+                       Assert.AreEqual(t.Result.Length, 0, "#3");
+               }
+
                [Test]
                public void WhenAllResult_WithNull ()
                {