|
From: <sm...@us...> - 2003-08-13 19:44:41
|
Update of /cvsroot/nmock/nmock/test/NMock/Dynamic
In directory sc8-pr-cvs1:/tmp/cvs-serv30014/test/NMock/Dynamic
Modified Files:
ClassGeneratorTest.cs
Log Message:
Added IInvocationHandler and generalised DynamicProxy generation
(with Jon Tirsen)
Index: ClassGeneratorTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/Dynamic/ClassGeneratorTest.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ClassGeneratorTest.cs 30 Jul 2003 17:28:01 -0000 1.11
--- ClassGeneratorTest.cs 13 Aug 2003 19:42:37 -0000 1.12
***************
*** 78,81 ****
--- 78,106 ----
#endregion
+ [TestFixture] public class ClassGeneratorInvocationHandlerTest
+ {
+ public class InvocationHandlerImpl : IInvocationHandler
+ {
+ public string invokedMethodName;
+ public object[] invokedArgs;
+
+ public object Call(string methodName, params object[] args)
+ {
+ invokedMethodName = methodName;
+ invokedArgs = args;
+ return null;
+ }
+ }
+
+ [Test] public void CreateGenericProxy()
+ {
+ ClassGenerator cg = new ClassGenerator();
+ InvocationHandlerImpl handler = new InvocationHandlerImpl();
+ IThingy thingy = (IThingy)cg.Generate(typeof(IThingy), handler);
+ thingy.NoArgs();
+ Assertion.AssertEquals("NoArgs", handler.invokedMethodName);
+ }
+ }
+
[TestFixture] public class ClassGeneratorTest
{
***************
*** 337,340 ****
}
-
}
--- 362,364 ----
|