views:

65

answers:

2

I would like to mock a class (i.e. with RhinoMocks) for which I don't have access to the code for (like say ManagementObject or ManagementObjectCollection) and for which methods/properties I am interested in

  • isn't virtual
  • isn't defined in an interface which the class implements

The way that I have been getting around this is to implement wrappers for these classes and to mock (and use) these wrappers.

Are there alternatives to this method?

+1  A: 

I think that TypeMock can handle this.

On Freund
A: 

If you used Java, you could use Mockito. It may mock classes without an interface.

furtelwart