return 42;
}
+ [Test]
+ public void CallMethodOnDateTime ()
+ {
+ var left = Expression.Call (Expression.Constant (DateTime.Now), typeof(DateTime).GetMethod ("AddDays"), Expression.Constant (-5.0));
+ var right = Expression.Constant (DateTime.Today);
+ var expr = Expression.GreaterThan (left, right);
+
+ var eq = Expression.Lambda<Func<bool>> (expr).Compile ();
+ Assert.IsFalse (eq ());
+ }
+
[Test]
[Category ("NotDotNet")] // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=339351
[ExpectedException (typeof (ArgumentException))]
}
[Test]
- [Category ("NotWorkingInterpreter")]
public void Connect282702 ()
{
var lambda = Expression.Lambda<Func<Func<int>>> (
// also could be a mutable value type, Delegate.CreateDelegate and MethodInfo.Invoke both can't handle this, we
// need to generate code.
if (!CollectionUtils.TrueForAll(parameters, (p) => !p.ParameterType.IsByRef) ||
- (!node.Method.IsStatic && node.Method.DeclaringType.IsValueType() && !node.Method.DeclaringType.IsPrimitive())) {
+ (!node.Method.IsStatic && node.Method.DeclaringType.IsValueType && node.Method.DeclaringType.Assembly != typeof (object).Assembly)) {
#if MONO_INTERPRETER
throw new NotImplementedException ("Interpreter of ref types");
#else