示例#1
0
        public void VirtualInterceptionWithoutAdditionalInterfaces()
        {
            DoNothingInterceptionBehavior.Reset();
            IInterceptionBehavior[] behaviourArray = new IInterceptionBehavior[1];
            behaviourArray[0] = new DoNothingInterceptionBehavior();

            var proxy = Intercept.NewInstance<HasVirtualMethods>(new VirtualMethodInterceptor(), behaviourArray);
            proxy.TargetMethod();
            Assert.AreEqual("Called", DoNothingInterceptionBehavior.PreCalled);
            Assert.AreEqual("Called", DoNothingInterceptionBehavior.PostCalled);
        }
示例#2
0
 public void MBROInterceptionWithoutAdditionalInterfaces()
 {
     DoNothingInterceptionBehavior.Reset();
     IInterceptionBehavior[] behaviourArray = new IInterceptionBehavior[1];
     behaviourArray[0] = new DoNothingInterceptionBehavior();
     ImplementsMBRO target = new ImplementsMBRO();
     ImplementsMBRO proxy = Intercept.ThroughProxy(target, new TransparentProxyInterceptor(), behaviourArray);
     proxy.TargetMethod();
     Assert.AreEqual("Called", DoNothingInterceptionBehavior.PreCalled);
     Assert.AreEqual("Called", DoNothingInterceptionBehavior.PostCalled);
 }