Exemple #1
0
        public void AllowsEmptyAttributeList()
        {
            AttributeAutoProxyCreator apc = new AttributeAutoProxyCreator();

            apc.AttributeTypes = new Type[0];
            apc.PostProcessAfterInitialization(new ApcTestObject(), "testObject");
        }
Exemple #2
0
        public void CreatesProxyOnAttributeMatch()
        {
            AttributeAutoProxyCreator apc = new AttributeAutoProxyCreator();

            apc.AttributeTypes = new Type[] { typeof(ApcTestAttribute) };

            object result = apc.PostProcessAfterInitialization(new AttributedApcTestObject(), "testObject");

            Assert.IsTrue(AopUtils.IsAopProxy(result));
        }
Exemple #3
0
        public void DoesNotCreateProxyIfEmptyAtributeList()
        {
            AttributeAutoProxyCreator apc = new AttributeAutoProxyCreator();

            apc.AttributeTypes = new Type[0];

            object result = apc.PostProcessAfterInitialization(new ApcTestObject(), "testObject");

            Assert.IsFalse(AopUtils.IsAopProxy(result));
        }
Exemple #4
0
        public void DoesNotCreateProxyOnInheritedAttributeMatchWhenNotCheckInherited()
        {
            AttributeAutoProxyCreator apc = new AttributeAutoProxyCreator();

            apc.AttributeTypes = new Type[] { typeof(ApcTestAttribute) };
            apc.CheckInherited = false;
            object result = apc.PostProcessAfterInitialization(new DerivedAttributedApcTestObject(), "testObject");

            Assert.IsFalse(AopUtils.IsAopProxy(result));
        }
Exemple #5
0
        public void DoesNotCheckMethodLevelAttributes()
        {
            AttributeAutoProxyCreator apc = new AttributeAutoProxyCreator();

            apc.AttributeTypes = new Type[] { typeof(ApcTestAttribute) };
            apc.CheckInherited = false; // (!)

            // does not check method level attributes!
            object result = apc.PostProcessAfterInitialization(new DerivedAttributedApcTestObject(), "testObject");

            Assert.IsFalse(AopUtils.IsAopProxy(result));
        }
Exemple #6
0
        public void DefaultsToNotCheckInherited()
        {
            AttributeAutoProxyCreator apc = new AttributeAutoProxyCreator();

            Assert.IsFalse(apc.CheckInherited);
        }
Exemple #7
0
        public void ThrowsOnAssigningNullAttributeList()
        {
            AttributeAutoProxyCreator apc = new AttributeAutoProxyCreator();

            Assert.Throws <ArgumentNullException>(() => apc.AttributeTypes = null);
        }
Exemple #8
0
        public void ThrowsOnMissingAttributeTypeList()
        {
            AttributeAutoProxyCreator apc = new AttributeAutoProxyCreator();

            Assert.Throws <ArgumentNullException>(() => apc.PostProcessAfterInitialization(new ApcTestObject(), "testObject"));
        }