From: Choy R. <ch...@us...> - 2005-02-19 21:34:48
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1357/DotNetMock/Dynamic Modified Files: DynamicMock.cs DynamicOrderedMock.cs ExpectationMethod.cs Log Message: Continuing with the OOAO with regard to the logic for method names of properties. Index: DynamicOrderedMock.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/DynamicOrderedMock.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DynamicOrderedMock.cs 19 Feb 2005 09:06:26 -0000 1.8 --- DynamicOrderedMock.cs 19 Feb 2005 21:34:39 -0000 1.9 *************** *** 51,55 **** public override object Call(MethodInfo mi, params object[] args) { ! string methodName = getMethodName(mi); if (values.Contains(methodName)) { --- 51,56 ---- public override object Call(MethodInfo mi, params object[] args) { ! MethodCall methodCall = new MethodCall(mi, args); ! string methodName = methodCall.MethodName; if (values.Contains(methodName)) { *************** *** 62,66 **** ExpectationMethod e = (ExpectationMethod)expectations[0]; expectations.RemoveAt(0); ! e.ActualMethodCall = new MethodCall(mi, args); e.Verify(); return e.ReturnValue; --- 63,67 ---- ExpectationMethod e = (ExpectationMethod)expectations[0]; expectations.RemoveAt(0); ! e.ActualMethodCall = methodCall; e.Verify(); return e.ReturnValue; Index: DynamicMock.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/DynamicMock.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** DynamicMock.cs 19 Feb 2005 09:06:26 -0000 1.16 --- DynamicMock.cs 19 Feb 2005 21:34:39 -0000 1.17 *************** *** 184,188 **** public virtual object Call(MethodInfo mi, params object[] args) { ! string methodName = getMethodName(mi); if (values.Contains(methodName)) { --- 184,189 ---- public virtual object Call(MethodInfo mi, params object[] args) { ! MethodCall methodCall = new MethodCall(mi, args); ! string methodName = methodCall.MethodName; if (values.Contains(methodName)) { *************** *** 205,209 **** ExpectationMethod e = (ExpectationMethod)list[0]; list.RemoveAt(0); ! e.ActualMethodCall = new MethodCall(mi, args); e.Verify(); return e.ReturnValue; --- 206,210 ---- ExpectationMethod e = (ExpectationMethod)list[0]; list.RemoveAt(0); ! e.ActualMethodCall = methodCall; e.Verify(); return e.ReturnValue; *************** *** 223,240 **** list.Add(e); } - /// <summary> - /// Returns the method name for the input <see cref="MethodInfo"/>. Accounts for property get and set methods. - /// </summary> - /// <param name="mi">method to get name from</param> - /// <returns>methond name for input method.</returns> - protected static string getMethodName( MethodInfo mi ) - { - string methodName = mi.Name; - if (methodName.StartsWith("get_") || methodName.StartsWith("set_")) - { - methodName = methodName.Substring(4); - } - return methodName; - } private void generate() --- 224,227 ---- Index: ExpectationMethod.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/ExpectationMethod.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ExpectationMethod.cs 19 Feb 2005 09:19:42 -0000 1.19 --- ExpectationMethod.cs 19 Feb 2005 21:34:39 -0000 1.20 *************** *** 113,124 **** public string ActualMethodName { ! get { ! string name = ActualMethod.Name; ! if ( name.StartsWith("get_") || name.StartsWith("set_") ) ! { ! name = name.Substring(4); ! } ! return name; ! } } /// <summary> --- 113,117 ---- public string ActualMethodName { ! get { return ActualMethodCall.MethodName; } } /// <summary> |