Exemple #1
0
        public void ReturnsThisWhenProxyIsIncompatible()
        {
            FooBar obj = new FooBar();

            AdvisedSupport advised = new AdvisedSupport();

            advised.Target     = obj;
            advised.Interfaces = new Type[] { typeof(IFoo) };

            IFoo proxy = (IFoo)CreateProxy(advised);

            Assert.AreSame(obj, proxy.GetBarThis(),
                           "Target should be returned when return types are incompatible");
            Assert.AreSame(proxy, proxy.GetFooThis(),
                           "Proxy should be returned when return types are compatible");
        }