public void PropertyExpressionForgetStatic() { // Forgets to mark the item as static var c = new PropertyExpressionTransformer(); var f = new PETest(); var paccess = Expression.Field(Expression.Constant(f), "theFieldBadStatic"); var pnew = c.Transform(paccess); }
public void PropertyExpressionWrongSignature() { // Totally wrong signature var c = new PropertyExpressionTransformer(); var f = new PETest(); var paccess = Expression.Field(Expression.Constant(f), "theFieldBadSignature"); var pnew = c.Transform(paccess); }
public void PropertyExpressionWrongReturnType() { // everything right but return type wrong. var c = new PropertyExpressionTransformer(); var f = new PETest(); var paccess = Expression.Field(Expression.Constant(f), "theFieldBadReturn"); var pnew = c.Transform(paccess); }
public void PropertyExpressionConstant() { var c = new PropertyExpressionTransformer(); var f = new PETest(); var paccess = Expression.Property(Expression.Constant(f), "theConstant"); var pnew = c.Transform(paccess); Assert.IsNotNull(pnew); Assert.AreEqual("f => 10.Invoke(value(LINQToTTreeLib.Tests.QueryVisitors.PropertyExpressionTransformerTest+PETest))", pnew.ToString()); }
public void PropertyExpressionNoReplacementP() { var c = new PropertyExpressionTransformer(); var f = new PETest(); var paccess = Expression.Property(Expression.Constant(f), "thePropertyRaw"); var pnew = c.Transform(paccess); Assert.IsNotNull(pnew); Assert.IsInstanceOfType(pnew, typeof(MemberExpression)); var pnewme = pnew as MemberExpression; Assert.AreEqual("thePropertyRaw", pnewme.Member.Name); }
public void PropertyExpressionNoReplacementF() { var c = new PropertyExpressionTransformer(); var f = new PETest(); var paccess = Expression.Field(Expression.Constant(f), "theFieldRaw"); var pnew = c.Transform(paccess); Assert.IsNotNull(pnew); Assert.IsInstanceOfType(pnew, typeof(MemberExpression)); var pnewme = pnew as MemberExpression; Assert.AreEqual("theFieldRaw", pnewme.Member.Name); }