コード例 #1
0
        public void CanCreateWrappedObject()
        {
            IConfigurationSource configurationSource = CreateConfigurationSource("CanCreateWrappedObject");

            Wrappable wrappable = PolicyInjection.Create <Wrappable>(configurationSource);

            Assert.IsNotNull(wrappable);
            Assert.IsTrue(RemotingServices.IsTransparentProxy(wrappable));
        }
コード例 #2
0
        public void CanCreateWrappedObject()
        {
            SetupContainer("CanCreateWrappedObject");

            Wrappable wrappable = PolicyInjection.Create <Wrappable>();

            Assert.IsNotNull(wrappable);
            Assert.IsTrue(RemotingServices.IsTransparentProxy(wrappable));
        }
コード例 #3
0
        public void WhenInjectorWrapsInstanceOfWrappableType_ThenMethodCallsAreIntercepted()
        {
            Wrappable wrappable = this.policyInjector.Wrap <Wrappable>(new Wrappable());

            wrappable.Method();
            wrappable.Method();
            wrappable.Method3();

            Assert.AreEqual(3, this.handler.CallCount);
        }
コード例 #4
0
        public void CanInterceptCallsToMBROOverInterface()
        {
            SetupContainer("CanInterceptCallsToMBROOverInterface");

            Wrappable wrappable = PolicyInjection.Create <Wrappable>();

            ((Interface)wrappable).Method();

            Assert.AreEqual(1, GlobalCountCallHandler.Calls["CanInterceptCallsToMBROOverInterface"]);
        }
コード例 #5
0
        public void CanInterceptWrappedObjectWithNonGenericMethods()
        {
            SetupContainer("CanCreateWrappedObject");

            Wrappable wrappable = (Wrappable)PolicyInjection.Create(typeof(Wrappable));

            wrappable.Method2();

            Assert.AreEqual(1, GlobalCountCallHandler.Calls["CanCreateWrappedObject"]);
        }
コード例 #6
0
        public void CanInterceptWrappedObject()
        {
            SetupContainer("CanCreateWrappedObject");

            Wrappable wrappable = PolicyInjection.Create <Wrappable>();

            wrappable.Method2();

            Assert.AreEqual(1, GlobalCountCallHandler.Calls["CanCreateWrappedObject"]);
        }
コード例 #7
0
        public void WhenInjectorWrapsInstanceOfWrappableType_ThenMethodCallsAreInterceptedAccordingToThePolicyInjectionRulesInTheConfigurationSource()
        {
            Wrappable wrappable = this.policyInjector.Wrap <Wrappable>(new Wrappable());

            wrappable.Method();
            wrappable.Method();
            wrappable.Method3();

            Assert.AreEqual(1, GlobalCountCallHandler.Calls.Count);
            Assert.AreEqual(3, GlobalCountCallHandler.Calls["counter"]);
        }
コード例 #8
0
        public void CanInterceptCallsToMBROOverInterface()
        {
            GlobalCountCallHandler.Calls.Clear();

            IConfigurationSource configurationSource = CreateConfigurationSource("CanInterceptCallsToMBROOverInterface");

            Wrappable wrappable = PolicyInjection.Create <Wrappable>(configurationSource);

            ((Interface)wrappable).Method();

            Assert.AreEqual(1, GlobalCountCallHandler.Calls["CanInterceptCallsToMBROOverInterface"]);
        }
コード例 #9
0
        public void CanInterceptWrappedObject()
        {
            GlobalCountCallHandler.Calls.Clear();

            IConfigurationSource configurationSource = CreateConfigurationSource("CanCreateWrappedObject");

            Wrappable wrappable = PolicyInjection.Create <Wrappable>(configurationSource);

            wrappable.Method2();

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