linux-packaging-mono/mcs/tests/test-async-12.cs
Jo Shields 8b9b85e7f5 Imported Upstream version 3.10.0
Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
2014-10-04 11:27:48 +01:00

42 lines
726 B
C#

using System;
using System.Threading.Tasks;
using System.Threading;
class C
{
static async Task<int> TestNested_1 ()
{
return Call (
await Task.Factory.StartNew (() => { Thread.Sleep (10); return 5; }).ConfigureAwait (false),
await Task.Factory.StartNew (() => -3).ConfigureAwait (false),
await Task.Factory.StartNew (() => 6).ConfigureAwait (false));
}
static int Call (int arg1, int arg2, int arg3)
{
if (arg1 != 5)
return 1;
if (arg2 != -3)
return 2;
if (arg3 != 6)
return 3;
return 0;
}
public static int Main ()
{
var t1 = TestNested_1 ();
if (!Task.WaitAll (new[] { t1 }, 1000))
return 1;
if (t1.Result != 0)
return 2;
Console.WriteLine ("ok");
return 0;
}
}