コード例 #1
0
ファイル: MethodInvocation.cs プロジェクト: vcgato29/moq
 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>();
 }
コード例 #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));
 }
コード例 #3
0
ファイル: MethodReturn.cs プロジェクト: weitzhandler/moq
        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);
        }
コード例 #4
0
ファイル: MethodReturn.cs プロジェクト: weitzhandler/moq
 public MethodReturn(IMethodInvocation invocation, Exception exception)
 {
     Outputs   = new ArgumentCollection(new object[0], new ParameterInfo[0]);
     Exception = exception;
 }