This gets messy. What if you have a constructor: .ctor(object[] obj) say you have to pass null as obj. With you approach you'll pass new object[1] instead.
That's just drawback of using params object[] because this means: "literally anything". That's why we deprecated this in DynamicProxy 2.2. On Jul 21, 10:23 pm, Kenneth Xu <[email protected]> wrote: > I have my own class to workaround those issues, here is the part to > workaround the problem you mentioned: > > public static class Mockery > { > private static readonly object [] SingleNull = new object[1]; > > public static T GenerateMock<T>(params object[] > argumentsForConstructor) > where T : class > { > return > MockRepository.GenerateMock<T>(argumentsForConstructor ?? SingleNull); > } > > /* other stuff */ > } > > Drop the class in your project and then replace MockRepository with > Mockery in your tests. It should pass. > > On Mon, Jul 20, 2009 at 6:50 PM, Alexey Diyan<[email protected]> wrote: > > When I pass one null-value into method MockRepository.GenerateMock<T> > > (params object[]) I have got following exception: > > "MissingMethodException: Can't find a constructor with matching > > arguments" > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/RhinoMocks?hl=en -~----------~----~----~----~------~----~------~--~---
