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
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hi,

I encountered a problem in mocking an interface which implements a .NET interface and 1 of our own interfaces.

public interface NewInterface: IBusinessObject, INotifyPropertyChanged

MockObject<NewInterface> mock = MockManager.MockObject<NewInterface>();

mock.ExpectAddEvent("PropertyChanged");

This throws

System.InvalidCastException : Unable to cast object of type 'TypeMock.MockObject`1[Interfaces.IBusinessObject]' to type 'TypeMock.MockObject`1[Interfaces.NewInterface]'.
at TypeMock.MockManager.MockObject[TMockedType]()
at Tests.TestAddEvent()

The weird part is that it not every time it throws the exception.

Im running Isolator 4.3.2 and running tests through NCover
asked by keke (2.3k points)

2 Answers

0 votes
Hi,

I'm sorry, but I couldn't reproduce it here.

Can you send a solution reproducing the problem? I'll send a separate mail.

Thanks,
answered by gilz (14.5k points)
0 votes
Im not seeing the problem when running the test locally through jetbrains Resharper unit test runner. We are seeing the exception only on our build server. Which runs TeamCity.
We are using NCover and jetbrains Teamcitys unit runner

EDIT: I'll send a mail as soon as possible.
answered by keke (2.3k points)
...