コード例 #1
0
        public InvocationMatcher(object target, MethodInfo method, IList <object> parameterValueConstraints)
        {
            if (InvocationTarget.IsDelegate(target) && method != null)
            {
                throw new ArgumentException("Can not specify delegate target and method", "method");
            }

            this.target = target;
            this.method = method;
            this.parameterValueConstraints = parameterValueConstraints;
        }
コード例 #2
0
        public static MockInvocationInterceptor GetFromTarget(object target)
        {
            target = InvocationTarget.UnwrapDelegateTarget(target);

            var proxy = target as IProxy;

            if (proxy == null)
            {
                throw new ArgumentException("Target is not an proxy", "target");
            }


            var mockInvocationInterceptor = proxy.InvocationInterceptor as MockInvocationInterceptor;

            if (mockInvocationInterceptor == null)
            {
                throw new ArgumentException("Target proxy is not an mock object", "target");
            }

            return(mockInvocationInterceptor);
        }
コード例 #3
0
 bool MatchesTarget(IProxy invocationTarget)
 {
     return(ReferenceEquals(invocationTarget, InvocationTarget.UnwrapDelegateTarget(target)));
 }