From: Choy R. <ch...@us...> - 2005-04-08 03:33:09
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Generate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24311/DotNetMock/Dynamic/Generate Modified Files: MockClassBuilder.cs Log Message: BUG 1178977 : argument names weren't showing up in assertion failure messages. this is because we didn't define the parameters in our proxy class with names. so I just copied the parameter meta data from the originating type. Index: MockClassBuilder.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Dynamic/Generate/MockClassBuilder.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockClassBuilder.cs 9 Jan 2005 06:48:35 -0000 1.1 --- MockClassBuilder.cs 8 Apr 2005 03:33:01 -0000 1.2 *************** *** 119,123 **** public void ImplementMockedMethod(MethodInfo mi) { ! ImplementMockedMethod(mi.Name, mi.ReturnType, getParameterTypes(mi)); } /// <summary> --- 119,123 ---- public void ImplementMockedMethod(MethodInfo mi) { ! ImplementMockedMethod(mi.Name, mi.ReturnType, getParameterTypes(mi), mi); } /// <summary> *************** *** 129,133 **** /// <param name="parameterTypes">array of <see cref="Type"/>s in /// the method signature</param> ! public void ImplementMockedMethod(string methodName, Type returnType, Type[] parameterTypes) { if ( IsCompiled ) --- 129,134 ---- /// <param name="parameterTypes">array of <see cref="Type"/>s in /// the method signature</param> ! /// <param name="mi">if not null, used to get extra parameter information</param> ! public void ImplementMockedMethod(string methodName, Type returnType, Type[] parameterTypes, MethodInfo mi) { if ( IsCompiled ) *************** *** 143,146 **** --- 144,160 ---- parameterTypes ); + if ( mi!=null ) + { + ParameterInfo[] pis = mi.GetParameters(); + for (int i = 0; i<pis.Length; ++i) + { + ParameterInfo pi = pis[i]; + methodBuilder.DefineParameter( + i+1, + pi.Attributes, + pi.Name + ); + } + } ILGenerator il = methodBuilder.GetILGenerator(); |