示例#1
0
        public override IMessage Invoke(IMessage msg)
        {
            IMethodCallMessage mcm = msg as IMethodCallMessage;
            if (mcm == null) return null;

            if (IsEqualsMethod(mcm))
            {
                return ReturnValue(HandleEquals(mcm), mcm);
            }

            if (IsGetHashCodeMethod(mcm))
            {
                return ReturnValue(GetHashCode(), mcm);
            }

            if (IsGetTypeMethod(mcm))
            {
                return ReturnValue(GetProxiedType(), mcm);
            }

            if (IsToStringMethod(mcm))
            {
                string retVal = String.Format("RemotingMock_{1}<{0}>", this.GetProxiedType().Name, this.GetHashCode());
                return ReturnValue(retVal, mcm);
            }

            RemotingInvocation invocation = new RemotingInvocation(this, mcm);
            _interceptor.Intercept(invocation);

            return ReturnValue(invocation.ReturnValue, invocation.Arguments, mcm);
        }
示例#2
0
        public override IMessage Invoke(IMessage msg)
        {
            IMethodCallMessage mcm = msg as IMethodCallMessage;

            if (mcm == null)
            {
                return(null);
            }

            if (IsEqualsMethod(mcm))
            {
                return(ReturnValue(HandleEquals(mcm), mcm));
            }

            if (IsGetHashCodeMethod(mcm))
            {
                return(ReturnValue(GetHashCode(), mcm));
            }

            if (IsGetTypeMethod(mcm))
            {
                return(ReturnValue(GetProxiedType(), mcm));
            }

            if (IsToStringMethod(mcm))
            {
                string retVal = String.Format("RemotingMock_{1}<{0}>", this.GetProxiedType().Name, this.GetHashCode());
                return(ReturnValue(retVal, mcm));
            }

            RemotingInvocation invocation = new RemotingInvocation(this, mcm);

            _interceptor.Intercept(invocation);

            return(ReturnValue(invocation.ReturnValue, invocation.Arguments, mcm));
        }