Example #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);
        }
Example #2
0
        private void ProcessEvent()
        {
            var form = _formPersister.Lookup(_parameterProvider.GetParameter("state"));

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

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

            return((IList)listConstructorInvoker.Invoke(null, length));
        }
 public override object?Invoke(MethodInfo method, object?[] args)
 {
     try
     {
         return(_invoker.Invoke(method, args));
     }
     catch (Exception e)
     {
         OnExceptionInvoked(new EventArgsT <Exception>(e));
         throw;
     }
 }
Example #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);
     }
 }
Example #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);
Example #9
0
        public object Invoke(Message message)
        {
            var request = (InvokeMethodRequest)message.BodyObject;

            return(methodInvoker.Invoke(addressable, request));
        }
Example #10
0
 public static Option <object> Invoke(this IMethodInvoker invoker, params object[] arguments)
 {
     return(invoker.Invoke(Option.None <string>(), arguments));
 }
Example #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);
Example #13
0
 public Task Invoke(object serviceInstance, IValueContainer parameters) => _invoker.Invoke(serviceInstance, parameters);
Example #14
0
 public IConcreteValue Invoke(IMethodDescriptor method, IEnumerable <IConcreteValue> arguments)
 {
     LastInvokedMethod = method;
     return(_original.Invoke(method, arguments));
 }
Example #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);
 /// <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));
 }