Cannot mock class with constructor having array parameter using Rhino Mocks

Posted by SharePoint Newbie on Stack Overflow See other posts from Stack Overflow or by SharePoint Newbie
Published on 2010-05-18T07:35:04Z Indexed on 2010/05/18 7:41 UTC
Read the original article Hit count: 304

Filed under:
|
|

Hi,

We cannot mock his class in RhinoMocks.

public class Service
{
    public Service(Command[] commands){}
}
public abstract class Command {}

// Code
var mock = MockRepository.GenerateMock<Service>(new Command[]{}); // or
mock = MockRepository.GenerateMock<Service>(null)

Rhino mocks fails complaining that it cannot find a constructor with matching arguments. What am I doing wrong?

Thanks,

© Stack Overflow or respective owner

Related posts about rhino-mocks

Related posts about mocking