|
From: <joe...@us...> - 2003-02-26 07:47:20
|
Update of /cvsroot/nmock/nmock/test/NMock
In directory sc8-pr-cvs1:/tmp/cvs-serv15626/test/NMock
Modified Files:
DynamicMockTest.cs
Log Message:
Fixed bug that causes the whole runtime to crash when trying to mock value types.
Bug fix by Luke Maxon @ ThoughtWorks
Index: DynamicMockTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/DynamicMockTest.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DynamicMockTest.cs 12 Dec 2002 21:39:44 -0000 1.4
--- DynamicMockTest.cs 26 Feb 2003 07:47:17 -0000 1.5
***************
*** 1,4 ****
--- 1,5 ----
using NUnit.Framework;
using System;
+ using System.Collections;
namespace NMock
***************
*** 102,105 ****
--- 103,126 ----
m2.Call("y", "something else");
m2.Verify();
+ }
+
+ [Test]
+ public void ValueType()
+ {
+ IMock mock = new DynamicMock(typeof(IValueType));
+ Assertion.AssertEquals("MockValueType", mock.Name);
+ ArrayList ret = new ArrayList();
+ DateTime date = DateTime.Now;
+ mock.ExpectAndReturn("Query", ret, "hello", date);
+
+ IValueType blah = (IValueType)mock.MockInstance;
+ Assertion.AssertEquals(ret, blah.Query("hello", date));
+
+ mock.Verify();
+ }
+
+ interface IValueType
+ {
+ ArrayList Query(string symbol, DateTime arg2);
}
|