[System.Windows.Forms] Disable failing test
[mono-project.git] / mcs / tests / test-async-85.cs
blob36c7a1e40b2c688a61603d78743f025db10972d0
1 using System;
2 using System.Threading.Tasks;
4 class Program
6 static int count;
8 static int Main ()
10 Test (false).Wait ();
11 Console.WriteLine (count);
12 if (count != 110011)
13 return 1;
15 count = 0;
16 Test (true).Wait ();
17 Console.WriteLine (count);
18 if (count != 111101)
19 return 2;
21 count = 0;
22 Test2 (false).Wait ();
23 Console.WriteLine (count);
24 if (count != 11)
25 return 3;
27 count = 0;
28 Test2 (true).Wait ();
29 Console.WriteLine (count);
30 if (count != 1101)
31 return 4;
33 return 0;
36 static async Task Test (bool throwTest)
38 try {
39 count += 1;
40 await Task.Delay (10);
42 if (throwTest)
43 throw new ApplicationException ();
45 count += 10;
46 } catch (ApplicationException) {
47 count += 100;
48 await Task.Delay (10);
49 count += 1000;
50 } finally {
51 count += 10000;
52 await Task.Delay (10);
53 count += 100000;
57 static async Task Test2 (bool throwTest)
59 try {
60 count += 1;
61 await Task.Delay (10);
63 if (throwTest)
64 throw new ApplicationException ();
66 count += 10;
67 } catch (ApplicationException) {
68 count += 100;
69 await Task.Delay (10);
70 count += 1000;
71 } finally {