/// <summary>
 /// Retrieve a mocked object from a transparent proxy
 /// </summary>
 /// <param name="proxy">Transparent proxy with a RemotingProxy instance behind it</param>
 /// <returns>Mocked object associated with the proxy</returns>
 /// <remarks>We use Equals() method to communicate with the real proxy behind the object.
 /// See IRemotingProxyOperation for more details</remarks>
 public static IMockedObject GetMockedObjectFromProxy(object proxy)
 {
     if (proxy == null) return null;
     RemotingProxyMockedObjectGetter getter = new RemotingProxyMockedObjectGetter();
     proxy.Equals(getter);
     return getter.MockedObject;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieve a mocked object from a transparent proxy
        /// </summary>
        /// <param name="proxy">Transparent proxy with a RemotingProxy instance behind it</param>
        /// <returns>Mocked object associated with the proxy</returns>
        /// <remarks>We use Equals() method to communicate with the real proxy behind the object.
        /// See IRemotingProxyOperation for more details</remarks>
        public static IMockedObject GetMockedObjectFromProxy(object proxy)
        {
            if (proxy == null)
            {
                return(null);
            }
            RemotingProxyMockedObjectGetter getter = new RemotingProxyMockedObjectGetter();

            proxy.Equals(getter);
            return(getter.MockedObject);
        }