Question

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?

Was it helpful?

Solution

I think that TypeMock can handle this.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top