Пример #1
0
        public void VirtualInterceptionWithAdditionalInterfaces()
        {
            IInterceptionBehavior[] behaviourArray = new IInterceptionBehavior[1];
            behaviourArray[0] = new BehavourForAdditionalInterface();
            TestClass123 target = new TestClass123();
            var proxy = (IAdditionalInterface)Intercept.NewInstanceWithAdditionalInterfaces<TestClass123>(new VirtualMethodInterceptor(), behaviourArray, new Type[] { typeof(IAdditionalInterface) });
            int behaviourReturn = proxy.DoNothing();

            Assert.AreEqual<int>(100, behaviourReturn);
        }
Пример #2
-1
        public void MBROInterceptionWithAdditionalInterfaces()
        {
            IInterceptionBehavior[] behaviourArray = new IInterceptionBehavior[1];
            behaviourArray[0] = new BehavourForAdditionalInterface();
            TestClass123 target = new TestClass123();
            var proxy = (IAdditionalInterface)Intercept.ThroughProxyWithAdditionalInterfaces<TestClass123>(target, new TransparentProxyInterceptor(), behaviourArray, new Type[] { typeof(IAdditionalInterface) });
            int behaviourReturn = proxy.DoNothing();

            Assert.AreEqual<int>(100, behaviourReturn);
        }