2010-01-19 Rodrigo Kumpera <rkumpera@novell.com>
authorRodrigo Kumpera <kumpera@gmail.com>
Tue, 19 Jan 2010 20:50:59 +0000 (20:50 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Tue, 19 Jan 2010 20:50:59 +0000 (20:50 -0000)
* MethodInfoTest.cs: Add a test for Invoke with generic variant
interfaces.

svn path=/trunk/mcs/; revision=149839

mcs/class/corlib/Test/System.Reflection/ChangeLog
mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs

index 583250f92ac810b42bd29eda8939e4d880c093e7..5bc866dd836e658d295d405686bc1b1bcc9b4e53 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-19 Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * MethodInfoTest.cs: Add a test for Invoke with generic variant
+       interfaces.
+
 2010-01-05 Rodrigo Kumpera  <rkumpera@novell.com>
 
        * ParameterInfoTest.cs: Add a test for default values from custom
index 794fd5d12bef921b985a49370164dc81c5131183..bce57696759a8d0b52c45beb75ad3608cb3ab7a8 100644 (file)
@@ -701,6 +701,32 @@ namespace MonoTests.System.Reflection
                        }
                }
 #endif
+#if NET_4_0
+               interface IMethodInvoke<out T>
+               {
+                   T Test ();
+               }
+
+               class MethodInvoke : IMethodInvoke<object>
+               {
+                   public object Test ()
+                   {
+                       return "MethodInvoke";
+                   }
+               }
+
+               [Test]
+               public void GetInterfaceMapWorksWithVariantIfaces ()
+               {
+                       var m0 = typeof (IMethodInvoke<object>).GetMethod ("Test");
+                       var m1 = typeof (IMethodInvoke<string>).GetMethod ("Test");
+                       var obj = new MethodInvoke ();
+
+                       Assert.AreEqual ("MethodInvoke", m0.Invoke (obj, new Object [0]));
+                       Assert.AreEqual ("MethodInvoke", m1.Invoke (obj, new Object [0]));
+               }
+#endif
+
        }
        
 #if NET_2_0