[mono/tests] Fix out of tree build.
[mono-project.git] / mcs / tests / test-async-21.cs
blobdc409b145d184a1d87bd8bf3465855594bef151c
1 using System;
2 using System.Threading.Tasks;
3 using System.Runtime.CompilerServices;
5 class S
7 public A GetAwaiter ()
9 return new A ();
13 class A : INotifyCompletion
15 bool IsCompleted {
16 get {
17 return false;
21 void INotifyCompletion.OnCompleted (Action a)
23 a ();
26 int GetResult ()
28 return 3;
31 static async Task<int> Test1 ()
33 dynamic d = new S ();
34 return await d;
37 public static int Main ()
39 var r = Test1 ();
40 if (!Task.WaitAll (new [] { r }, 1000))
41 return 1;
43 Console.WriteLine ("ok");
44 return 0;