linux-packaging-mono/mcs/tests/test-async-21.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

46 lines
565 B
C#

using System;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
class S
{
public A GetAwaiter ()
{
return new A ();
}
}
class A : INotifyCompletion
{
bool IsCompleted {
get {
return false;
}
}
void INotifyCompletion.OnCompleted (Action a)
{
a ();
}
int GetResult ()
{
return 3;
}
static async Task<int> Test1 ()
{
dynamic d = new S ();
return await d;
}
public static int Main ()
{
var r = Test1 ();
if (!Task.WaitAll (new [] { r }, 1000))
return 1;
Console.WriteLine ("ok");
return 0;
}
}