chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
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?
asked by jimmy505 (640 points)

3 Answers

0 votes
Hi Jimmy,

The exception looks like something we fixed in version 4.3. Are you using the latest Isolator version? If not, you can download it from here.

Please try it and let me know if it fixed the problem.

Thanks,
answered by gilz (14.5k points)
0 votes
Hi,

Yes, I am using version 4.3

jimmy
answered by jimmy505 (640 points)
0 votes
Hi,
We need some additional information in order to handle the problem.
The best - if you will send us the solution.

Thank you.

Menahem Cohen
answered by Menahem (260 points)
...