SPRNET-1433 - IsAopProxy and IsAopProxyType now check for inheritance based proxies too
This commit is contained in:
@@ -60,7 +60,7 @@ namespace Spring.Aop.Framework
|
||||
/// <returns><see langword="true"/> if the supplied <paramref name="objectType"/> is an AOP proxy type.</returns>
|
||||
public static bool IsAopProxyType(Type objectType)
|
||||
{
|
||||
return IsCompositionAopProxyType(objectType) || IsDecoratorAopProxyType(objectType);
|
||||
return IsCompositionAopProxyType(objectType) || IsDecoratorAopProxyType(objectType) || IsInheritanceAopProxyType(objectType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -77,7 +77,7 @@ namespace Spring.Aop.Framework
|
||||
/// </returns>
|
||||
public static bool IsAopProxy(object instance)
|
||||
{
|
||||
return IsCompositionAopProxy(instance) || IsDecoratorAopProxy(instance);
|
||||
return IsCompositionAopProxy(instance) || IsDecoratorAopProxy(instance) || IsInheritanceAopProxy(instance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
public void TargetIsNotAProxy()
|
||||
{
|
||||
Assert.False(AopUtils.IsAopProxy(_target));
|
||||
Assert.False(AopUtils.IsInheritanceAopProxy(_target));
|
||||
Assert.False(AopUtils.IsInheritanceAopProxyType(_target.GetType()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -69,8 +71,12 @@ namespace Spring.Aop.Framework.DynamicProxy
|
||||
{
|
||||
var proxy = (TestObject)ctx["michael"];
|
||||
Assert.AreEqual("Michael", proxy.Name);
|
||||
|
||||
Assert.True(AopUtils.IsInheritanceAopProxyType(proxy.GetType()));
|
||||
Assert.True(AopUtils.IsAopProxyType(proxy.GetType()));
|
||||
|
||||
Assert.True(AopUtils.IsInheritanceAopProxy(proxy));
|
||||
Assert.True(AopUtils.IsAopProxy(proxy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user