public void NoRemotingInterceptionOccursWhenNoPoliciesAreDefined_Interface()
        {
            IUnityContainer uc = new UnityContainer();

            uc.AddNewExtension <Interception>();

            uc.RegisterType <IInterceptionTestClass_Interface, InterceptionTestClass_Interface>(new ContainerControlledLifetimeManager());

            IInterceptionTestClass_Interface beforeInterception = uc.Resolve <IInterceptionTestClass_Interface>();

            uc.Configure <Interception>()
            .SetDefaultInterceptorFor <IInterceptionTestClass_Interface>(new TransparentProxyInterceptor());

            IInterceptionTestClass_Interface afterInterception = uc.Resolve <IInterceptionTestClass_Interface>();

            Assert.AreSame(beforeInterception, afterInterception);
            Assert.IsFalse(RemotingServices.IsTransparentProxy(beforeInterception));
            Assert.IsFalse(RemotingServices.IsTransparentProxy(afterInterception));
        }
        public void TransparentProxyInterceptionOccursWhenPoliciesAreDefined_Interface()
        {
            IUnityContainer uc = new UnityContainer();

            uc.AddNewExtension <Interception>();

            uc.RegisterType <IInterceptionTestClass_Interface, InterceptionTestClass_Interface>(new ContainerControlledLifetimeManager());

            IInterceptionTestClass_Interface beforeInterception = uc.Resolve <IInterceptionTestClass_Interface>();

            uc.Configure <Interception>()
            .SetDefaultInterceptorFor <IInterceptionTestClass_Interface>(new TransparentProxyInterceptor())
            .AddPolicy("Always Matches")
            .AddMatchingRule <AlwaysMatchingRule>()
            .AddCallHandler <ConvenienceInterceptionAPI.CallCountHandler>();

            IInterceptionTestClass_Interface afterInterception = uc.Resolve <IInterceptionTestClass_Interface>();

            Assert.AreNotSame(beforeInterception, afterInterception);
            Assert.IsFalse(RemotingServices.IsTransparentProxy(beforeInterception));
            Assert.IsTrue(RemotingServices.IsTransparentProxy(afterInterception));
        }