No it's not. With the constructor you defined, you should get a null, not object[1]. I'm away from my PC so cannot test it. But it is the first element in the object[] that supposed to be passed to the constructor. If not, then, IMHO, it is another issue to be resolved.
Sent from my Verizon Wireless BlackBerry -----Original Message----- From: Krzysztof Ko mic (2) [email protected] Date: Wed, 22 Jul 2009 00:01:34 To: Rhino.Mocks<[email protected]> Subject: [RhinoMocks] Re: Unable to pass null value into mock if original class has constructor with one parameter 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 -~----------~----~----~----~------~----~------~--~---
