Exemple #1
0
 public MethodInvocation(object target, MethodBase method, params object[] arguments)
 {
     // TODO: validate that arguments length and type match the method info?
     Target     = target ?? throw new ArgumentNullException(nameof(target));
     MethodBase = method ?? throw new ArgumentNullException(nameof(method));
     Arguments  = new ArgumentCollection(arguments, method.GetParameters());
     Context    = new Dictionary <string, object>();
 }
Exemple #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(RuntimeHelpers.GetHashCode(target), method, arguments));
 }
Exemple #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 (var 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);
        }
Exemple #4
0
 public MethodReturn(IMethodInvocation invocation, Exception exception)
 {
     Outputs   = new ArgumentCollection(new object[0], new ParameterInfo[0]);
     Exception = exception;
 }