Merge pull request #4935 from lambdageek/dev-handles-may
[mono.git] / mcs / tests / gtest-etree-31.cs
1 using System;
2 using System.Linq.Expressions;
3
4 class X
5 {
6         class HasAction
7         {
8                 public void Start ()
9                 {
10                 }
11         }
12
13         public static int Main ()
14         {
15                 var expectedObject = typeof (HasAction).GetMethod("Start");
16
17                 Expression<Func<HasAction, Action>> methodToUse = r => r.Start;
18                 
19                 UnaryExpression unary = methodToUse.Body as UnaryExpression;
20                 MethodCallExpression methodCall = unary.Operand as MethodCallExpression;
21                 ConstantExpression constantExpression = methodCall.Object as ConstantExpression;
22
23                 if (expectedObject != constantExpression.Value)
24                         return 1;
25
26                 if (methodCall.Object == null)
27                         return 2;
28
29                 return 0;
30         }
31 }