Ejemplo n.º 1
0
 private string GetCsharpName(string valueText)
 {
     if (_type == typeof(Direction))
     {
         valueText = valueText.ToLower();
     }
     return(TraversalParser.GetCsharpName(valueText));
 }
Ejemplo n.º 2
0
        public object GetValue()
        {
            var    type     = typeof(P);
            object instance = null;

            for (var i = 1; i < Tokens.Count; i++)
            {
                var token = Tokens[i];
                token.SetContextParameterValues(_contextParameterValues);
                var method = type.GetMethod(TraversalParser.GetCsharpName(token.Name),
                                            BindingFlags.Static | BindingFlags.Public);
                if (method == null)
                {
                    throw new InvalidOperationException($"Predicate (P) method '{token}' not found for testing");
                }
                instance = method.Invoke(instance,
                                         new object[] { token.Parameters.Select(p => p.GetValue()).ToArray() });
            }
            return(instance);
        }