public void ComplexExpressions() { Assert.AreEqual(435, _parser.Evaluate <int>("Math.Max(Data.Method2(Data.Int1+10,300),Data.Method1(Data.Int1))+(\"x\" + 5).Length")); Assert.AreEqual(17, _parser.Evaluate <int>("Data.Method2(Data.Method2(3,4),Data.Method1(5))")); Assert.AreEqual(100, _parser.Evaluate <int>("Max(Max(100,5),Func(10))")); Assert.AreEqual(1000, _parser.Evaluate <int>("Max(Max(100,5),Func(200))")); }
protected override bool Validate(object value, Type targetType) { ExpressionParser parser = new CSharpParser(); return(parser.Evaluate <bool>("!!(" + _expression + ")", new ValidationContext(value, Context))); }