Пример #1
0
        public virtual void CanCastToOtherInterfaceAndCallMethodsOnIt()
        {
            IUnityContainer container = GetContainer();

            IInterceptionTestClass sut = this.GetSUT(container);

            Assert.IsTrue(System.Runtime.Remoting.RemotingServices.IsTransparentProxy(sut));

            IInterceptionTestClassEmpty otherInterface = sut as IInterceptionTestClassEmpty;

            Assert.IsTrue(System.Runtime.Remoting.RemotingServices.IsTransparentProxy(otherInterface));
            otherInterface.DoSomething();

            Assert.AreEqual(1, container.Resolve <TestCallHandler>("TestCallHandler").InterceptionCount);
        }
Пример #2
0
        public virtual void CanCastToOtherInterface()
        {
            IUnityContainer container = GetContainer();

            IInterceptionTestClass sut = this.GetSUT(container);

            Assert.IsTrue(System.Runtime.Remoting.RemotingServices.IsTransparentProxy(sut));

            IInterceptionTestClassEmpty otherInterface = sut as IInterceptionTestClassEmpty;

            Assert.IsTrue(System.Runtime.Remoting.RemotingServices.IsTransparentProxy(otherInterface));

            switch (this.Mode)
            {
            case TestMode.Interface:
                Assert.IsNotNull(otherInterface);
                break;

            case TestMode.MarshalByRefObject:
                Assert.IsNotNull(otherInterface);
                break;
            }
        }