|
From: <sk...@us...> - 2003-10-16 13:49:20
|
Update of /cvsroot/nmock/nmock/test/NMock
In directory sc8-pr-cvs1:/tmp/cvs-serv16965/test/NMock
Modified Files:
DynamicMockTest.cs
Log Message:
Fixed bug with null parameters at execution to do with method resolution
Index: DynamicMockTest.cs
===================================================================
RCS file: /cvsroot/nmock/nmock/test/NMock/DynamicMockTest.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** DynamicMockTest.cs 13 Aug 2003 21:19:58 -0000 1.15
--- DynamicMockTest.cs 16 Oct 2003 13:49:13 -0000 1.16
***************
*** 262,265 ****
--- 262,310 ----
mock.Verify();
}
+
+
+ #region null parameter bug
+ interface WithDifferentTypesOfParameters
+ {
+ void SomeParametersMethod(string p1, string p2);
+ }
+
+ [Test]
+ public void TestNullParameterCanStillResolveCorrectMethod()
+ {
+ DynamicMock mock = new DynamicMock(typeof(WithDifferentTypesOfParameters));
+ WithDifferentTypesOfParameters instance = (WithDifferentTypesOfParameters)mock.MockInstance;
+
+ //works
+ mock.Expect("SomeParametersMethod", "foo", "foo");
+ instance.SomeParametersMethod("foo", "foo");
+
+ //fails
+ mock.Expect("SomeParametersMethod", "foo", null);
+ instance.SomeParametersMethod("foo", null);
+
+ mock.Verify();
+ }
+
+ [Test]
+ public void TestNullConstraintsCanStillResolveCorrectMethod()
+ {
+ DynamicMock mock = new DynamicMock(typeof(WithDifferentTypesOfParameters));
+ WithDifferentTypesOfParameters instance = (WithDifferentTypesOfParameters)mock.MockInstance;
+
+ //works
+ mock.Expect("SomeParametersMethod", "foo", "foo");
+ instance.SomeParametersMethod("foo", "foo");
+
+ //bug - cannot resolve this
+ mock.Expect("SomeParametersMethod", "foo", new IsNull());
+ instance.SomeParametersMethod("foo", null);
+
+ mock.Verify();
+ }
+
+
+ #endregion
+
}
}
|