do not check order sequence if option /order was not used
[mono.git] / mcs / tests / test-async-35.cs
1 using System;
2 using System.Reflection;
3 using System.Threading.Tasks;
4 using System.Runtime.CompilerServices;
5 using System.Linq;
6
7 namespace N.M
8 {
9         class C
10         {
11                 public static async Task<int> AsyncMethod ()
12                 {
13                         await Task.Delay (1);
14                         return 0;
15                 }
16
17                 static int Main ()
18                 {
19                         var m = typeof (C).GetMethod ("AsyncMethod");
20                         var attr = m.GetCustomAttribute<AsyncStateMachineAttribute> ();
21                         if (attr == null)
22                                 return 1;
23
24                         if (attr.StateMachineType == null)
25                                 return 2;
26
27                         Func<Task<int>> a = async () => await AsyncMethod ();
28
29                         var c = typeof (C).GetMethods (BindingFlags.NonPublic | BindingFlags.Static).Where (l =>
30                                 l.IsDefined (typeof (AsyncStateMachineAttribute))).Count ();
31
32                         if (c != 1)
33                                 return 3;
34
35                         return 0;
36                 }
37         }
38 }