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);
        }
Пример #2
0
 bool MatchesTarget(IProxy invocationTarget)
 {
     return(ReferenceEquals(invocationTarget, InvocationTarget.UnwrapDelegateTarget(target)));
 }