I am using the following code to unit test that a generic method is being called:
MockManager.Init();
Mock mock = MockManager.Mock(typeof (UnityContainer));
mock.ExpectAndReturn("RegisterType", mock.MockedInstance, typeof (IOrdersView), typeof (OrdersView));
var mockRegionManager = (IRegionManager)RecorderManager.CreateMockedObject(typeof(IRegionManager));
IUnityContainer mockedContainer = new UnityContainer();
IModule module = new OrdersModule(mockedContainer, mockRegionManager);
module.Initialize();
MockManager.Verify();
I'm getting the following error:
TypeMock.TypeMockException:
*** Method RegisterType in type Microsoft.Practices.Unity.UnityContainer has no matching overload that returns TypeMock.Mock+a.
Basically I want to verify that the following is called in the module.Initialize() method:
mockedContainer.RegisterType<IOrdersView, OrdersView>();
I don't care what the RegisterType method returns.
Any ideas?