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)); }
public void DoesNotCreateProxyIfEmptyAtributeList() { AttributeAutoProxyCreator apc = new AttributeAutoProxyCreator(); apc.AttributeTypes = new Type[0]; object result = apc.PostProcessAfterInitialization(new ApcTestObject(), "testObject"); Assert.IsFalse(AopUtils.IsAopProxy(result)); }
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)); }
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)); }
public void ThrowsOnMissingAttributeTypeList() { AttributeAutoProxyCreator apc = new AttributeAutoProxyCreator(); Assert.Throws <ArgumentNullException>(() => apc.PostProcessAfterInitialization(new ApcTestObject(), "testObject")); }