/// <summary>
        ///		Obtiene el valor de una constante
        /// </summary>
        private string TransformExpressionConstant(ExpressionConstant expression)
        {
            if (expression.Value == null)
            {
                return("none");
            }
            else
            {
                switch (expression.Type)
                {
                case SymbolModel.SymbolType.Boolean:
                    if ((bool)expression.Value)
                    {
                        return("True");
                    }
                    else
                    {
                        return("False");
                    }

                case SymbolModel.SymbolType.Date:
                    return($"'{(DateTime) expression.Value:yyyy-MM-dd}'");

                case SymbolModel.SymbolType.Numeric:
                    return("" + ((double)expression.Value).ToString(System.Globalization.CultureInfo.InvariantCulture));

                case SymbolModel.SymbolType.String:
                    return($"'{expression.Value.ToString()}'");

                default:
                    throw new NotImplementedException("Constant expression unknown");
                }
            }
        }
Esempio n. 2
0
 private void VerifyPropertyExpression(ExpressionConstant expressionConstant)
 {
     new ExpressionParser()
     .Parse <TestEntity>(expressionConstant.Source)
     .ToString()
     .Should()
     .Be(expressionConstant.Compiled);
 }
Esempio n. 3
0
        private string GetFunctionHelp(string name)
        {
            ExpressionConstant exp = NamedConstants.Expressions[name];

            return($"{name}:\n    {exp.Description}");
        }