Exemple #1
0
        private void HandleSetup(object[] arguments, IInternalSetupBase setup, MethodBase originalMethod)
        {
            if (setup.Exception != null)
            {
                throw setup.Exception.Value;
            }

            setup.CallbackAction?.Invoke(arguments.Skip(setup.ArgumentsToSkipInCallbacks).ToArray());

            HandleOutParameters(arguments, setup, originalMethod);
        }
Exemple #2
0
        private void HandleOutParameters(object[] arguments, IInternalSetupBase setup, MethodBase originalMethod)
        {
            ParameterInfo[] parameters = originalMethod.GetParameters();

            for (int i = 0; i < parameters.Length; ++i)
            {
                int offset = originalMethod.IsStatic ? 0 : 1;

                if (parameters[i].IsOut)
                {
                    arguments[i + offset] = _expressionHelper.GetValue(setup.MethodCall.Arguments[i + offset]);
                }
            }
        }