Esempio n. 1
0
        public void DoesNotCacheWithDifferentInterfaces()
        {
            ProxyFactory advisedSupport = new ProxyFactory(new TestObject());

            CreateAopProxy(advisedSupport);

            advisedSupport = new ProxyFactory(new TestObject());
            advisedSupport.AddInterface(typeof(IPerson));
            CreateAopProxy(advisedSupport);

            AssertAopProxyTypeCacheCount(2);

            // Same with Introductions
            advisedSupport = new ProxyFactory(new TestObject());
            TimestampIntroductionInterceptor ti = new TimestampIntroductionInterceptor();

            ti.TimeStamp = new DateTime(666L);
            IIntroductionAdvisor introduction = new DefaultIntroductionAdvisor(ti, typeof(ITimeStamped));

            advisedSupport.AddIntroduction(introduction);
            CreateAopProxy(advisedSupport);

            AssertAopProxyTypeCacheCount(3);
        }
        public void DoesNotCacheWithDifferentInterfaces()
        {
            ProxyFactory advisedSupport = new ProxyFactory(new TestObject());
            CreateAopProxy(advisedSupport);

            advisedSupport = new ProxyFactory(new TestObject());
            advisedSupport.AddInterface(typeof(IPerson));
            CreateAopProxy(advisedSupport);

            AssertAopProxyTypeCacheCount(2);

            // Same with Introductions
            advisedSupport = new ProxyFactory(new TestObject());
            TimestampIntroductionInterceptor ti = new TimestampIntroductionInterceptor();
            ti.TimeStamp = new DateTime(666L);
            IIntroductionAdvisor introduction = new DefaultIntroductionAdvisor(ti, typeof(ITimeStamped));
            advisedSupport.AddIntroduction(introduction);
            CreateAopProxy(advisedSupport);

            AssertAopProxyTypeCacheCount(3);
        }