If you do it at this point it will. Let's try another one.

Say you have a ctor like this: Foo.ctor(IBar[] bars); and you want to
pass empty array of IBar

if you call Mockery.GenerateMock<Foo>(new IBar[]{}); it won't work.
because arrays in .NET are covariant and CLR will treat this as if you
passed empty array of objects as your params array, which would
indicate you want to call the default constructor, which is not what
you want in this case. You'd have to pass it explicitly as new object[]
{new IBar[]{}} which is inconsistent with the other cases and
confusing.

On Jul 22, 4:38 pm, Kenneth Xu <[email protected]> wrote:
> Here is the test case to prove:
>
>     public class Foo
>     {
>         public Foo(object [] o)
>         {
>             Console.WriteLine(o??(object)"null array");
>         }
>
>         public static void Main(string[] args)
>         {
>             Mockery.GenerateMock<Foo>(null);
>         }
>     }
>
> output: null array
>
> 2009/7/22 Krzysztof Koźmic (2) <[email protected]>:
>
> > That's just drawback of using params object[] because this means:
> > "literally anything". That's why we deprecated this in DynamicProxy
>
> Krzysztof,
>
> I'm curious to know what is the replacement for this.
>
> Cheers,
> Kenneth
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to