Beispiel #1
0
 public MethodInvocation(object target, MethodBase method, params object[] arguments)
 {
     // TODO: validate that arguments length and type match the method info?
     Target     = target;
     MethodBase = method;
     Arguments  = new ArgumentCollection(arguments, method.GetParameters());
     Context    = new Dictionary <string, object>();
 }
Beispiel #2
0
 public MethodInvocation(object target, MethodBase method, params object[] arguments)
 {
     // TODO: validate that arguments length and type match the method info?
     Target     = target;
     MethodBase = method;
     Arguments  = new ArgumentCollection(arguments, method.GetParameters());
     Context    = new Dictionary <string, object>();
     equatable  = new Lazy <IStructuralEquatable>(() => Tuple.Create(target, method, arguments));
 }
Beispiel #3
0
        public MethodReturn(IMethodInvocation invocation, object returnValue, object[] allArguments)
        {
            this.invocation   = invocation;
            this.allArguments = allArguments;

            ReturnValue = returnValue;

            var outputArgs  = new List <object>();
            var outputInfos = new List <ParameterInfo>();
            var allInfos    = invocation.MethodBase.GetParameters();

            for (int i = 0; i < allInfos.Length; i++)
            {
                var info = allInfos[i];
                if (info.ParameterType.IsByRef)
                {
                    outputArgs.Add(allArguments[i]);
                    outputInfos.Add(info);
                }
            }

            Outputs = new ArgumentCollection(outputArgs, outputInfos);
        }
Beispiel #4
0
 public MethodReturn(IMethodInvocation invocation, Exception exception)
 {
     Outputs   = new ArgumentCollection(new object[0], new ParameterInfo[0]);
     Exception = exception;
 }