コード例 #1
0
ファイル: InterceptionFixture.cs プロジェクト: CFMITL/unity
        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
ファイル: InterceptionFixture.cs プロジェクト: CFMITL/unity
 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);
 }