[mono/tests] Fix out of tree build.
[mono-project.git] / mcs / tests / test-async-33.cs
blob4bb0ad9af4ad48818b52602aa1e972e8ac1e1977
1 using System;
2 using System.Threading;
3 using System.Threading.Tasks;
5 class A
7 public virtual Task<int> Foo (int value)
9 return Task.FromResult (value);
12 public virtual Task<int> Prop { get; set; }
15 class B : A
17 public override Task<int> Prop {
18 get {
19 throw new ApplicationException ();
21 set {
22 throw new ApplicationException ();
26 public override async Task<int> Foo (int value)
28 return await base.Foo (value) + 1;
31 public async Task<int> Foo2 (int value)
33 base.Prop = Task.FromResult (value);
34 return await base.Prop;
38 class Program
40 public static int Main()
42 var b = new B ();
43 if (b.Foo (3).Result != 4)
44 return 1;
46 if (b.Foo2 (5).Result != 5)
47 return 2;
49 Console.WriteLine("ok");
50 return 0;