Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SPRNET-1433 - `IsAopProxy` and `IsAopProxyType` now check for inherit…

…ance based proxies too
  • Loading branch information...
commit 55bdec00e5465d8e613efb7cd722d7251734e5ef 1 parent 3fc968f
@serra serra authored
View
4 src/Spring/Spring.Aop/Aop/Framework/AopUtils.cs
@@ -60,7 +60,7 @@ public sealed class AopUtils
/// <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 @@ public static bool IsAopProxyType(Type objectType)
/// </returns>
public static bool IsAopProxy(object instance)
{
- return IsCompositionAopProxy(instance) || IsDecoratorAopProxy(instance);
+ return IsCompositionAopProxy(instance) || IsDecoratorAopProxy(instance) || IsInheritanceAopProxy(instance);
}
/// <summary>
View
6 test/Spring/Spring.Aop.Tests/Aop/Framework/DynamicProxy/IsAopProxyTests.cs
@@ -22,6 +22,8 @@ public void SetUp()
public void TargetIsNotAProxy()
{
Assert.False(AopUtils.IsAopProxy(_target));
+ Assert.False(AopUtils.IsInheritanceAopProxy(_target));
+ Assert.False(AopUtils.IsInheritanceAopProxyType(_target.GetType()));
}
[Test]
@@ -69,8 +71,12 @@ public void IsInheritanceBasedProxy()
{
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));
}
}
}

0 comments on commit 55bdec0

Please sign in to comment.
Something went wrong with that request. Please try again.