Update mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/RelaxngPattern.cs
[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 class C
8 {
9         public static async Task<int> AsyncMethod ()
10         {
11                 await Task.Delay (1);
12                 return 0;
13         }
14
15         static int Main ()
16         {
17                 var m = typeof (C).GetMethod ("AsyncMethod");
18                 var attr = m.GetCustomAttribute<AsyncStateMachineAttribute> ();
19                 if (attr == null)
20                         return 1;
21
22                 if (attr.StateMachineType == null)
23                         return 2;
24
25                 Func<Task<int>> a = async () => await AsyncMethod ();
26
27                 var c = typeof (C).GetMethods (BindingFlags.NonPublic | BindingFlags.Static).Where (l =>
28                         l.IsDefined (typeof (AsyncStateMachineAttribute))).Count ();
29
30                 if (c != 1)
31                         return 3;
32
33                 return 0;
34         }
35 }