public void UserDefinedClass() { // We can use the simplest version of GetMethod because we already know only one // exists in the very simple class we're using for the tests. var mi = typeof(OpClass).GetMethod("op_Addition"); var left = new OpClass(); var expr = Expression.Add(Expression.Constant(left), Expression.Constant(new OpClass())); Assert.AreEqual(ExpressionType.Add, expr.NodeType, "Add#09"); Assert.AreEqual(typeof(OpClass), expr.Type, "Add#10"); Assert.AreEqual(mi, expr.Method, "Add#11"); Assert.AreEqual("op_Addition", expr.Method.Name, "Add#12"); Assert.AreEqual("(value(MonoTests.System.Linq.Expressions.OpClass) + value(MonoTests.System.Linq.Expressions.OpClass))", expr.ToString(), "Add#13"); Expression.Lambda <Func <OpClass> >(expr); #if false // // We do not have support for objects that are not really // constants, like this case. Need to figure out what to do // with those // Func <OpClass> compiled = l.Compile(); Assert.AreEqual(left, compiled()); #endif }
public void UserClassValue() { OpClass oc = new OpClass(); ConstantExpression expr = Expression.Constant(oc); Assert.AreEqual(ExpressionType.Constant, expr.NodeType, "Constant#29"); Assert.AreEqual(oc, expr.Value, "Constant#30"); Assert.AreEqual(typeof(OpClass), expr.Type, "Constant#31"); Assert.AreEqual("value(MonoTests.System.Linq.Expressions.OpClass)", expr.ToString(), "Constant#32"); }
public static OpClass WrongUnaryParameterCount(OpClass a, OpClass b) { GC.KeepAlive(b); return(a); }
public OpClass WrongUnaryNotStatic(OpClass a) { return(a); }
public static void WrongUnaryReturnVoid(OpClass a) { GC.KeepAlive(a); }
public static OpClass WrongUnaryParameterCount(OpClass a, OpClass b) { Theraot.No.Op(b); return(a); }
public static void WrongUnaryReturnVoid(OpClass a) { Theraot.No.Op(a); }
public static OpClass WrongUnaryParameterCount(OpClass a, OpClass b) { return(a); }
public static void WrongUnaryReturnVoid(OpClass a) { }