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; }
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); }
bool MatchesTarget(IProxy invocationTarget) { return(ReferenceEquals(invocationTarget, InvocationTarget.UnwrapDelegateTarget(target))); }