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

I am testing the current version of TypeMock (version 2.2) and I am getting a error with the Dynamic Mock objects example in the user guide.

The example in the guide was:(with the added IList cast, little bug in the documentation :wink: )

// Mock our interface 
MockObject mock = MockManager.MockObject(typeof(IList));
// Lets mock a return of 4 for Count 
// Get our concrete mocked Object
IList list = (IList) mock.Object;
// Let just test it

When I run the example it seems to throw an exception on the MockObject() method.
The message is the following:
System.TypeLoadException : Method CopyTo in type MockIList from assembly DynamicMockAssembly, Version= does not have an implementation.
at System.Reflection.Emit.TypeBuilder.TermCreateClass(TypeToken handle, Module module)
at System.Reflection.Emit.TypeBuilder.CreateType()
at TypeMock.ClassGenerator.Generate(Type type)
at TypeMock.MockManager.MockObject(Type type, Constructor mockConstructors)
at TypeMock.MockManager.MockObject(Type type)

Did I need to configure something else to make this example work or is it a bug?


asked by benjamin dover (1.8k points)

3 Answers

0 votes
Hi Benjamin,
Thanks for pointing out the typo.
This seem like a bug, I will check it out...
answered by scott (32k points)
0 votes
This was a bug an has been fixed, you can now download version 2.2.1

We have also as a treat added a new Check.CustomCheck() API
answered by scott (32k points)
0 votes
Hi Scott,

The version 2.2.1 fixed my problem.


answered by benjamin dover (1.8k points)