[System.Windows.Forms] Disable failing test
[mono-project.git] / mcs / tests / test-async-14.cs
blobff15d7fef75640a6197fb9a7eb00c724e05afe5e
1 using System;
2 using System.Threading.Tasks;
3 using System.Threading;
5 class C
7 public async Task<int> TestResult ()
9 if (await Task.Factory.StartNew (() => 8).ConfigureAwait (false) != 9) {
10 return 2;
13 return 0;
16 public static int Main ()
18 var c = new C ();
19 var t = c.TestResult ();
21 if (!Task.WaitAll (new[] { t }, 3000))
22 return 1;
24 if (t.Status != TaskStatus.RanToCompletion)
25 return 2;
27 if (t.Result != 2)
28 return 3;
30 Func<Task<int>> f = async () => {
31 var tr = await Task.Factory.StartNew (() => 1).ConfigureAwait (false);
32 if (tr == 1)
33 return 3;
35 return 1;
38 var t2 = f ();
40 if (!Task.WaitAll (new[] { t2 }, 3000))
41 return 4;
43 if (t2.Status != TaskStatus.RanToCompletion)
44 return 5;
46 if (t2.Result != 3)
47 return 6;
49 Console.WriteLine ("ok");
50 return 0;