From: Choy R. <ch...@us...> - 2005-02-19 07:48:28
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/Dynamic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12357/DotNetMock.Tests/Dynamic Modified Files: MethodCallTests.cs Log Message: added test to check that overloaded methods don't match. Index: MethodCallTests.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock.Tests/Dynamic/MethodCallTests.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MethodCallTests.cs 18 Feb 2005 06:37:35 -0000 1.1 --- MethodCallTests.cs 19 Feb 2005 07:48:17 -0000 1.2 *************** *** 23,26 **** --- 23,27 ---- void Method3(int x, string y, double z); void Method4(); + void Method4(int a); } interface IMethodsA *************** *** 30,35 **** static readonly MethodInfo method3 = typeof(IMethods).GetMethod("Method3"); ! static readonly MethodInfo method4 = typeof(IMethods).GetMethod("Method4"); static readonly MethodInfo methodA3 = typeof(IMethodsA).GetMethod("Method3"); [Test] public void MethodCallToString() --- 31,41 ---- static readonly MethodInfo method3 = typeof(IMethods).GetMethod("Method3"); ! static readonly MethodInfo method4 = typeof(IMethods).GetMethod("Method4", new Type[0]); static readonly MethodInfo methodA3 = typeof(IMethodsA).GetMethod("Method3"); + static readonly MethodInfo method4a = + typeof(IMethods).GetMethod( + "Method4", + new Type[] { typeof(int) } + ); [Test] public void MethodCallToString() *************** *** 47,50 **** --- 53,57 ---- MethodCall mc4 = new MethodCall(method4); MethodCall mc5 = new MethodCall(methodA3, 1, "two", 3.4); + MethodCall mc6 = new MethodCall(method4a, 1); Assert.AreEqual(mc1, mc2); *************** *** 52,57 **** Assert.IsFalse(mc1.Equals(mc4)); Assert.IsFalse(mc1.Equals(mc5)); ! Assert.IsFalse(mc1.Equals(null)); ! Assert.IsFalse(mc1.Equals("text")); } [ExpectedException( --- 59,65 ---- Assert.IsFalse(mc1.Equals(mc4)); Assert.IsFalse(mc1.Equals(mc5)); ! Assert.IsFalse(mc1.Equals(null), "MethodCall not equal to null"); ! Assert.IsFalse(mc1.Equals("text"), "MethodCall not equal to string"); ! Assert.IsFalse(mc4.Equals(mc6), "overloaded methods don't match"); } [ExpectedException( |