예제 #1
0
        internal IEnumerable <string> NullCheckParameters(object systemUnderTest, MethodBase method)
        {
            Guard.AgainstNull(systemUnderTest, nameof(systemUnderTest));
            Guard.AgainstNull(method, nameof(method));

            var failingChecks = new List <string>();
            var paramCombos   = paramBuilder.GetNullCombinations(method.GetParameters());

            foreach (var(paramName, paramList) in paramCombos)
            {
                try
                {
                    methodInvoker.Invoke(method, systemUnderTest, paramList);
                }
                catch (ArgumentNullException)
                {
                    continue;
                }
                catch (TargetInvocationException ex)
                    when(ex.InnerException is ArgumentNullException)
                    {
                        continue;
                    }
                catch
                {
                }

                // if we get here, no null exception thrown
                failingChecks.Add(paramName);
            }

            return(failingChecks);
        }
예제 #2
0
        private void ProcessEvent()
        {
            var form = _formPersister.Lookup(_parameterProvider.GetParameter("state"));

            form.FormEngine = this;
            _methodInvoker.Invoke(form, _parameterProvider);
            UpdateForm(form);
        }
예제 #3
0
        public override object CreateInstance()
        {
            if (defaultConstructorInvoker == null)
            {
                throw new MissingMethodException("Default constructor not found!");
            }

            return(defaultConstructorInvoker.Invoke(null));
        }
예제 #4
0
        public override IList CreateListInstance(int length)
        {
            if (listConstructorInvoker == null)
            {
                throw new MissingMethodException("List constructor not found!");
            }

            return((IList)listConstructorInvoker.Invoke(null, length));
        }
예제 #5
0
 public override object?Invoke(MethodInfo method, object?[] args)
 {
     try
     {
         return(_invoker.Invoke(method, args));
     }
     catch (Exception e)
     {
         OnExceptionInvoked(new EventArgsT <Exception>(e));
         throw;
     }
 }
예제 #6
0
 public void Invoke(Form form, IParameterProvider parameterProvider)
 {
     try
     {
         _methodInvoker.Invoke(form, parameterProvider);
     }
     catch (TargetInvocationException e)
     {
         Handle(e.InnerException);
     }
     catch (Exception t)
     {
         Handle(t);
     }
 }
예제 #7
0
        public override void Visit(MethodCall expression)
        {
            if (expression.LambdaExpression != null)
            {
                result = CallOperator(expression);

                if (result == null)
                {
                    throw new NLinqException("Unknown operator: " + expression.Identifier.Text);
                }
            }
            else
            {
                object[] parameters = new object[expression.Parameters.Length];
                Type[] types = new Type[expression.Parameters.Length];

                if (expression.Parameters.Length > 0)
                {
                    object oldResult = result;

                    for (int j = 0; j < expression.Parameters.Length; j++)
                    {
                        expression.Parameters[j].Accept(this);
                        parameters[j] = result;
                    }

                    result = oldResult;
                }

                if (result == null)
                {
                    return;
                }

                if (!methodInvoker.Invoke(result, expression.Identifier.Text, parameters, ref result))
                {
                    result = CallOperator(expression);

                    if (result == null)
                    {
                        throw new NLinqException("Method not found with specified arguments: " + expression.Identifier.Text);
                    }
                }
            }
        }
 public override object Invoke(object target, params object[] parameters) => invoker.Invoke(target, parameters);
예제 #9
0
        public object Invoke(Message message)
        {
            var request = (InvokeMethodRequest)message.BodyObject;

            return(methodInvoker.Invoke(addressable, request));
        }
예제 #10
0
 public static Option <object> Invoke(this IMethodInvoker invoker, params object[] arguments)
 {
     return(invoker.Invoke(Option.None <string>(), arguments));
 }
예제 #11
0
 public static Option <object> Invoke(this IMethodInvoker invoker, string methodName, params object[] arguments)
 {
     return(invoker.Invoke(Option.Some(methodName), arguments));
 }
 public override object Invoke(params object[] parameters) => invoker.Invoke(null, parameters);
예제 #13
0
 public Task Invoke(object serviceInstance, IValueContainer parameters) => _invoker.Invoke(serviceInstance, parameters);
예제 #14
0
 public IConcreteValue Invoke(IMethodDescriptor method, IEnumerable <IConcreteValue> arguments)
 {
     LastInvokedMethod = method;
     return(_original.Invoke(method, arguments));
 }
예제 #15
0
        public object Invoke(IInvocationInfo invocationInfo)
        {
            var result = _invoker.Invoke(invocationInfo.TargetMethod.Name, invocationInfo.Arguments);

            return(result.ValueOrDefault());
        }
 protected override object Invoke(IMethodInvoker invoker, object target, params object[] args) => invoker.Invoke(target, args);
예제 #17
0
 /// <summary> Offers an extension point for subclasses (in alternate Uberspects)
 /// to alter the invocation after any array wrapping or varargs handling
 /// has already been completed.
 /// </summary>
 /// <since> 1.6
 /// </since>
 protected internal virtual object DoInvoke(object instance, object[] parameter)
 {
     return(methodInvoker.Invoke(instance, (object[])parameter));
 }