using System;
using System.Reflection;
+using System.Reflection.Emit;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
}
[Test]
- [Category ("NotWorkingInterpreter")]
public void CallMethodOnStruct ()
{
var param = Expression.Parameter (typeof (EineStrukt), "s");
}
[Test]
- [Category ("NotWorkingInterpreter")]
public void CallStaticMethodWithRefParameter ()
{
var p = Expression.Parameter (typeof (int), "i");
}
[Test]
- [Category ("NotWorkingInterpreter")]
public void CallStaticMethodWithRefParameterAndOtherParameter ()
{
var i = Expression.Parameter (typeof (int), "i");
Assert.AreEqual ("foo42", lamda (42, "foo"));
}
+#if !MONOTOUCH
+ [Test]
+ public void CallDynamicMethod_ToString ()
+ {
+ // Regression test for #49686
+ var m = new DynamicMethod ("intIntId", typeof (int), new Type [] { typeof (int) });
+ var ilg = m.GetILGenerator ();
+ ilg.Emit (OpCodes.Ldarg_0);
+ ilg.Emit (OpCodes.Ret);
+
+ var i = Expression.Parameter (typeof (int), "i");
+ var e = Expression.Call (m, i);
+
+ Assert.IsNotNull (e.ToString ());
+ }
+
+ [Test]
+ public void CallDynamicMethod_CompileInvoke ()
+ {
+ var m = new DynamicMethod ("intIntId", typeof (int), new Type [] { typeof (int) });
+ var ilg = m.GetILGenerator ();
+ ilg.Emit (OpCodes.Ldarg_0);
+ ilg.Emit (OpCodes.Ret);
+
+ var i = Expression.Parameter (typeof (int), "i");
+ var e = Expression.Call (m, i);
+
+ var lambda = Expression.Lambda<Func<int, int>> (e, i).Compile ();
+ Assert.AreEqual (42, lambda (42));
+ }
+#endif
+
public static int Bang (Expression i)
{
return (int) (i as ConstantExpression).Value;
}
[Test]
- [Category ("NotWorkingInterpreter")]
public void Connect282729 ()
{
// test from https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=282729
}
[Test]
- [Category ("NotWorking")]
- [Category ("NotWorkingInterpreter")]
public void Connect290278 ()
{
// test from https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=290278
}
[Test]
- [Category ("NotWorkingInterpreter")]
public void Connect297597 ()
{
// test from https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=297597
[Test]
[Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=319190
+ [Category ("NotWorkingInterpreter")]
public void Connect319190 ()
{
var lambda = Expression.Lambda<Func<bool>> (
}
[Test]
- [Category ("NotWorkingInterpreter")]
public void CallNullableGetValueOrDefault () // #568989
{
var value = Expression.Parameter (typeof (int?), "value");