using System;
using System.Reflection;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Threading;
[Test] //See bug #372406
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void CreateDelegate1_Method_Private_Instance ()
}
[Test] // CreateDelegate (Type, MethodInfo)
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #14163
#endif
public void CreateDelegate1_Method_Instance ()
}
[Test]
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void Virtual ()
}
[Test]
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #14163
#endif
public void NullTarget_Instance ()
}
[Test] // #617161
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void ClosedOverNullReferenceStaticMethod ()
}
[Test] // #475962
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void ClosedOverNullReferenceInstanceMethod ()
delegate int ByRefDelegate (ref FooStruct s, int a, int b, int c, int d);
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")]
#endif
[Test]
}
}
- delegate int IntNoArgs ();
+ public delegate int IntNoArgs ();
[Test]
public void CreateDelegateWithAbstractMethods ()
{
string retarg (string s);
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void CreateDelegateWithLdFtnAndAbstractMethod ()
{
Assert.IsTrue (d (0, 0));
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
public static void DynInvokeWithClosedFirstArg (object a, object b)
{
}
}
#endif
+ public delegate void DoExecuteDelegate1 (C c);
+ public delegate void DoExecuteDelegate2 (C c);
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void DelegateCombineDifferentTypes () {
+ var b = new B ();
+ var del1 = new DoExecuteDelegate1 (b.DoExecute);
+ var del2 = new DoExecuteDelegate2 (b.DoExecute);
+ var del = Delegate.Combine (del1, del2);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void DelegateRemoveDifferentTypes () {
+ var b = new B ();
+ var del1 = new DoExecuteDelegate1 (b.DoExecute);
+ var del2 = new DoExecuteDelegate2 (b.DoExecute);
+ var del = Delegate.Remove (del1, del2);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void CreateDelegateThrowsAnArgumentExceptionWhenCalledWithAnOpenGeneric()
+ {
+ var m = GetType().GetMethod("AnyGenericMethod");
+ Delegate.CreateDelegate(typeof(Action), this, m);
+ }
+
+ public void AnyGenericMethod<T>()
+ {
+ }
+
static bool Int32D2 (int x, int y)
{
return (x & y) == y;