User: xtoff
Date: 2009/11/19 10:22 AM
Modified:
/DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/
InterceptorSelectorTestCase.cs
/DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/
InterfaceProxyWithoutTargetGenerator.cs
Log:
- Applied patch from James Curran fixing DYNPROXY-ISSUE-124 -
"InterfaceProxyWithoutTargetGenerator ctor missing selector parameter".
- Added tests to assert this feature works for all kinds of proxies (and that
the issue in indeed fixed).
File Changes:
Directory: /DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/
=============================================================
File [modified]: InterceptorSelectorTestCase.cs
Delta lines: +0 -0
===================================================================
Directory: /DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/
==================================================================
File [modified]: InterfaceProxyWithoutTargetGenerator.cs
Delta lines: +56 -1
===================================================================
---
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/InterceptorSelectorTestCase.cs
2009-11-17 13:33:57 UTC (rev 6337)
+++
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/InterceptorSelectorTestCase.cs
2009-11-19 17:22:05 UTC (rev 6338)
@@ -18,6 +18,7 @@
using System.Collections.Generic;
using System.Reflection;
+ using Castle.DynamicProxy.Tests.Classes;
using Castle.DynamicProxy.Tests.Interfaces;
using Core.Interceptor;
@@ -131,7 +132,7 @@
}
[Test]
- public void
When_two_selectors_present_and_not_equal_should_cache_type_anyway()
+ public void
When_two_selectors_present_and_not_equal_should_cache_type_anyway_InterfaceProxyWithTargetInterface()
{
var options1 = new ProxyGenerationOptions { Selector =
new AllInterceptorSelector() };
var options2 = new ProxyGenerationOptions
@@ -147,6 +148,60 @@
Assert.AreSame(proxy1.GetType(), proxy2.GetType());
}
+
+ [Test]
+ public void
When_two_selectors_present_and_not_equal_should_cache_type_anyway_InterfaceProxyWithTarget()
+ {
+ var options1 = new ProxyGenerationOptions { Selector =
new AllInterceptorSelector() };
+ var options2 = new ProxyGenerationOptions
+ {
+ Selector = new
TypeInterceptorSelector<CallCountingInterceptor>()
+ };
+
+ var proxy1 =
generator.CreateInterfaceProxyWithTarget<IOne>(new One(), options1);
+ var proxy2 =
generator.CreateInterfaceProxyWithTarget<IOne>(new One(), options2);
+ proxy1.OneMethod();
+ proxy2.OneMethod();
+
+
+ Assert.AreSame(proxy1.GetType(), proxy2.GetType());
+ }
+
+ [Test]
+ public void
When_two_selectors_present_and_not_equal_should_cache_type_anyway_InterfaceProxyWithoutTarget()
+ {
+ var options1 = new ProxyGenerationOptions { Selector =
new AllInterceptorSelector() };
+ var options2 = new ProxyGenerationOptions
+ {
+ Selector = new
TypeInterceptorSelector<SetReturnValueInterceptor>()
+ };
+
+ var proxy1 =
generator.CreateInterfaceProxyWithoutTarget(typeof(IOne), Type.EmptyTypes,
options1, new SetReturnValueInterceptor(2));
+ var proxy2 =
generator.CreateInterfaceProxyWithoutTarget(typeof(IOne), Type.EmptyTypes,
options2, new SetReturnValueInterceptor(2));
+ (proxy1 as IOne).OneMethod();
+ (proxy2 as IOne).OneMethod();
+
+
+ Assert.AreSame(proxy1.GetType(), proxy2.GetType());
+ }
+
+ [Test]
+ public void
When_two_selectors_present_and_not_equal_should_cache_type_anyway_ClassProxy()
+ {
+ var options1 = new ProxyGenerationOptions { Selector =
new AllInterceptorSelector() };
+ var options2 = new ProxyGenerationOptions
+ {
+ Selector = new
TypeInterceptorSelector<CallCountingInterceptor>()
+ };
+
+ var proxy1 =
generator.CreateClassProxy(typeof(ServiceClass), Type.EmptyTypes, options1);
+ var proxy2 =
generator.CreateClassProxy(typeof(ServiceClass), Type.EmptyTypes, options2);
+ (proxy1 as ServiceClass).Sum(2, 2);
+ (proxy2 as ServiceClass).Sum(2, 2);
+
+
+ Assert.AreSame(proxy1.GetType(), proxy2.GetType());
+ }
}
--
You received this message because you are subscribed to the Google Groups
"Castle Project Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-commits?hl=.