User: xtoff
Date: 2009/11/13 02:09 PM
Modified:
/DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/
InterfaceProxyWithTargetInterfaceTestCase.cs,
InvocationMethodInvocationTargetTestCase.cs
/DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/
InvocationTypeGenerator.cs
Log:
- added call to EnsureValidTarget(); in InvokeMethodOnTarget on invocations
for mixin methods on interface proxy with target interface, to throw meaningful
exceptions when an invalid target is set.
File Changes:
Directory: /DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/
=============================================================
File [modified]: InterfaceProxyWithTargetInterfaceTestCase.cs
Delta lines: +1 -1
===================================================================
---
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/InvocationMethodInvocationTargetTestCase.cs
2009-11-13 20:10:12 UTC (rev 6324)
+++
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/InvocationMethodInvocationTargetTestCase.cs
2009-11-13 21:09:23 UTC (rev 6325)
@@ -101,7 +101,7 @@
public void
ClassProxyForGeneric_MethodInvocationTarget_should_be_proxyMethod()
{
var interceptor = new KeepDataInterceptor();
- var proxy =
(Castle.DynamicProxy.Tests.GenClasses.IChangeTracking)generator.CreateClassProxy<GenClassWithExplicitImpl<int>>(interceptor);
+ var proxy =
(IChangeTracking)generator.CreateClassProxy<GenClassWithExplicitImpl<int>>(interceptor);
Assert.IsTrue(proxy.IsChanged);
Assert.IsNotNull(interceptor.Invocation.MethodInvocationTarget);
File [modified]: InvocationMethodInvocationTargetTestCase.cs
Delta lines: +0 -0
===================================================================
Directory: /DynamicProxy/trunk/src/Castle.DynamicProxy/Generators/
==================================================================
File [modified]: InvocationTypeGenerator.cs
Delta lines: +16 -0
===================================================================
---
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/InterfaceProxyWithTargetInterfaceTestCase.cs
2009-11-13 20:10:12 UTC (rev 6324)
+++
DynamicProxy/trunk/src/Castle.DynamicProxy.Tests/InterfaceProxyWithTargetInterfaceTestCase.cs
2009-11-13 21:09:23 UTC (rev 6325)
@@ -84,5 +84,21 @@
Assert.AreEqual(2, result);
}
+
+ [Test]
+ public void
Should_detect_and_report_setting_null_as_target_for_Mixin_methods()
+ {
+ var options = new ProxyGenerationOptions();
+ options.AddMixinInstance(new Two());
+ var interceptor = new ChangeTargetInterceptor(null);
+ var proxy =
generator.CreateInterfaceProxyWithTargetInterface(typeof(IOne),
+
new One(),
+
options,
+
interceptor);
+
+ Assert.Throws(typeof(NotImplementedException),()=>
+
+ (proxy as ITwo).TwoMethod());
+ }
}
--
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=.