public void CanInterceptCallsToDerivedOfMBRO()
        {
            GlobalCountCallHandler.Calls.Clear();

            IUnityContainer container = CreateContainer("CanInterceptCallsToDerivedOfMBRO")
                                        .RegisterType <DerivedWrappable>(
                new Interceptor <TransparentProxyInterceptor>(),
                new InterceptionBehavior <PolicyInjectionBehavior>());

            DerivedWrappable wrappable = container.Resolve <DerivedWrappable>();

            wrappable.Method2();

            Assert.AreEqual(1, GlobalCountCallHandler.Calls["CanInterceptCallsToDerivedOfMBRO"]);
        }
Example #2
0
        public void InterfaceImplementationsOnDerivedClassesAreWrappedMultipleTimes()
        {
            GlobalCountCallHandler.Calls.Clear();

            IUnityContainer container = CreateContainer(
                "InterfaceImplementationsOnDerivedClassesAreWrappedMultipleTimes")
                                        .RegisterType <DerivedWrappable>(
                new Interceptor <VirtualMethodInterceptor>(),
                new InterceptionBehavior <PolicyInjectionBehavior>());

            DerivedWrappable wrappable = container.Resolve <DerivedWrappable>();

            wrappable.Method();

            Assert.AreEqual(1, GlobalCountCallHandler.Calls["InterfaceImplementationsOnDerivedClassesAreWrappedMultipleTimes"]);
        }
Example #3
0
        public void InterfaceImplementationsOnDerivedClassesAreWrappedMultipleTimes()
        {
            GlobalCountCallHandler.Calls.Clear();

            IUnityContainer container = CreateContainer("InterfaceImplementationsOnDerivedClassesAreWrappedMultipleTimes");

            container
            .Configure <Interception>()
            .SetInterceptorFor <DerivedWrappable>(new TransparentProxyInterceptor());

            DerivedWrappable wrappable = container.Resolve <DerivedWrappable>();

            wrappable.Method();

            Assert.AreEqual(1, GlobalCountCallHandler.Calls["InterfaceImplementationsOnDerivedClassesAreWrappedMultipleTimes"]);
        }
Example #4
0
        public void CanInterceptCallsToDerivedOfMBRO()
        {
            GlobalCountCallHandler.Calls.Clear();

            IUnityContainer container = CreateContainer("CanInterceptCallsToDerivedOfMBRO");

            container
            .Configure <Interception>()
            .SetInterceptorFor <DerivedWrappable>(new TransparentProxyInterceptor());

            DerivedWrappable wrappable = container.Resolve <DerivedWrappable>();

            wrappable.Method2();

            Assert.AreEqual(1, GlobalCountCallHandler.Calls["CanInterceptCallsToDerivedOfMBRO"]);
        }