示例#1
0
        private IInvocationExpression GetMockedMethodInvocation(IInvocationExpression invocationExpression)
        {
            if (invocationExpression == null || !_methodIdentifier.IsMoqSetupMethod(invocationExpression))
            {
                return(null);
            }

            var methodArguments = invocationExpression.ArgumentList.Arguments;

            if (methodArguments.Count != 1)
            {
                return(null);
            }

            var lambdaExpression = methodArguments[0].Value as ILambdaExpression;

            if (lambdaExpression == null)
            {
                return(null);
            }

            return(lambdaExpression.BodyExpression as IInvocationExpression);
        }
 protected override bool IsSetupMethod(IMoqMethodIdentifier identifier, IInvocationExpression methodInvocation)
 {
     return(identifier.IsMoqSetupMethod(methodInvocation));
 }
 protected override bool IsSetupMethod(IInvocationExpression invocationExpression)
 {
     return(_methodIdentifier.IsMoqSetupMethod(invocationExpression));
 }