We have a VB.net function with the following signature in class InitializerFactory:
Public Shared Function Create(ByRef ui As Object) As IModeInitializer
I'm attempting to test this function by passing in a mock of ui (using Rhino Mocks):
MainForm ui = mocks.StrictMock<MainForm>();
IModeInitializer item = InitializerFactory.Create(ref ui);
When attempting to pass ui as a parameter, I get the following errors:
- The best overloaded method match for 'InitializerFactory.Create(ref object)' has some invalid arguments
- Argument '1': cannot convert from 'ref MainForm' to 'ref object'
Ideally, the solution would be to extract an interface on UI (or its class, MainForm) but that's not doable by any means - it's an extremely bloated class.
I also can't declare ui as an Object
, or else I can't mock the methods inside of it since the methods don't belong to an Object
type.
My question is -- what am I doing wrong?