Ejemplo n.º 1
0
        private static IEnumerable <IArgumentConstraint> GetArgumentConstraints(IEnumerable <ParsedArgumentExpression> argumentExpressions, ExpressionArgumentConstraintFactory constraintFactory)
        {
            if (argumentExpressions == null)
            {
                return(Enumerable.Empty <IArgumentConstraint>());
            }

            return
                (from argument in argumentExpressions
                 select constraintFactory.GetArgumentConstraint(argument));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExpressionCallMatcher" /> class.
        /// </summary>
        /// <param name="parsedExpression">The parsed call specification.</param>
        /// <param name="constraintFactory">The constraint factory.</param>
        /// <param name="methodInfoManager">The method info manager to use.</param>
        public ExpressionCallMatcher(ParsedCallExpression parsedExpression, ExpressionArgumentConstraintFactory constraintFactory, MethodInfoManager methodInfoManager)
        {
            this.methodInfoManager = methodInfoManager;
            this.Method            = parsedExpression.CalledMethod;

            var constraints = new IArgumentConstraint[parsedExpression.ArgumentsExpressions.Length];

            for (var i = 0; i < constraints.Length; i++)
            {
                constraints[i] = constraintFactory.GetArgumentConstraint(parsedExpression.ArgumentsExpressions[i]);
            }

            this.argumentConstraints = constraints;
            this.argumentsPredicate  = this.ArgumentsMatchesArgumentConstraints;
        }
 private static IEnumerable <IArgumentConstraint> GetArgumentConstraints(IEnumerable <ParsedArgumentExpression> argumentExpressions, ExpressionArgumentConstraintFactory constraintFactory) =>
 from argument in argumentExpressions
 select constraintFactory.GetArgumentConstraint(argument);
Ejemplo n.º 4
0
        private static IEnumerable<IArgumentConstraint> GetArgumentConstraints(IEnumerable<ParsedArgumentExpression> argumentExpressions, ExpressionArgumentConstraintFactory constraintFactory)
        {
            if (argumentExpressions == null)
            {
                return Enumerable.Empty<IArgumentConstraint>();
            }

            return
                from argument in argumentExpressions
                select constraintFactory.GetArgumentConstraint(argument);
        }