public InvocationShape(LambdaExpression expression, MethodInfo method, IReadOnlyList <Expression> arguments = null, bool exactGenericTypeArguments = false, bool skipMatcherInitialization = false, bool allowNonOverridable = false) { Debug.Assert(expression != null); Debug.Assert(method != null); if (!allowNonOverridable) // the sole currently known legitimate case where this evaluates to `false` is when setting non-overridable properties via LINQ to Mocks { Guard.IsOverridable(method, expression); Guard.IsVisibleToProxyFactory(method); } this.Expression = expression; this.Method = method; if (arguments != null && !skipMatcherInitialization) { (this.argumentMatchers, this.Arguments) = MatcherFactory.CreateMatchers(arguments, method.GetParameters()); } else { this.argumentMatchers = noArgumentMatchers; this.Arguments = arguments ?? noArguments; } this.exactGenericTypeArguments = exactGenericTypeArguments; }
public InvocationShape(LambdaExpression expression, MethodInfo method, IReadOnlyList <Expression> arguments = null) { Debug.Assert(expression != null); Debug.Assert(method != null); Guard.IsOverridable(method, expression); Guard.IsVisibleToProxyFactory(method); this.Expression = expression; this.Method = method; this.Arguments = arguments ?? noArguments; this.argumentMatchers = arguments != null?MatcherFactory.CreateMatchers(arguments, method.GetParameters()) : noArgumentMatchers; }
public InvocationShape(LambdaExpression expression, MethodInfo method, IReadOnlyList <Expression> arguments = null, bool exactGenericTypeArguments = false) { Debug.Assert(expression != null); Debug.Assert(method != null); Guard.IsOverridable(method, expression); Guard.IsVisibleToProxyFactory(method); this.Expression = expression; this.Method = method; if (arguments != null) { (this.argumentMatchers, this.Arguments) = MatcherFactory.CreateMatchers(arguments, method.GetParameters()); } else { this.argumentMatchers = noArgumentMatchers; this.Arguments = noArguments; } this.exactGenericTypeArguments = exactGenericTypeArguments; }