diff options
author | Marek Safar <marek.safar@gmail.com> | 2009-09-11 21:13:04 +0400 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2009-09-11 21:13:04 +0400 |
commit | ffbf5538c55a3bf40ec949dfbb2a020527e59c59 (patch) | |
tree | 828781fbd12d6299290852e481f189c99a03714b /mcs/tests/dtest-005.cs | |
parent | 82da599f08eb951e04896f8c99cd0a037a20c55d (diff) |
New tests.
svn path=/trunk/mcs/; revision=141782
Diffstat (limited to 'mcs/tests/dtest-005.cs')
-rw-r--r-- | mcs/tests/dtest-005.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/mcs/tests/dtest-005.cs b/mcs/tests/dtest-005.cs new file mode 100644 index 00000000000..d6156bb1811 --- /dev/null +++ b/mcs/tests/dtest-005.cs @@ -0,0 +1,42 @@ +using System; +using System.Dynamic; + +public class MyObject : DynamicObject +{ + public static int Get, Invoke; + + public override bool TryGetMember (GetMemberBinder binder, out object result) + { + Console.WriteLine ("Get"); + Get++; + result = null; + return true; + } + + public override bool TryInvokeMember (InvokeMemberBinder binder, object[] args, out object result) + { + Console.WriteLine ("Invoke"); + Invoke++; + result = null; + return true; + } +} + +public class Tests +{ + public static int Main () + { + dynamic d = new MyObject (); + + var g = d.GetMe; + if (MyObject.Get != 1 && MyObject.Invoke != 0) + return 1; + + d.printf ("Hello, World!"); + if (MyObject.Get != 1 && MyObject.Invoke != 1) + return 2; + + Console.WriteLine ("ok"); + return 0; + } +} |