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'm getting an exception TypeLoadException was unhandled:
Method 'get_InternalMessageId' on type 'Mock0000MailItem' from assembly 'DynamicMockAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=a0857b23fb3f20d9' is overriding a method that is not visible from that assembly.

The code to reproduce this is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Exchange.Data.Transport;
using TypeMock.ArrangeActAssert;
namespace type_mock{
class Program{
static void Main (string [] args){
MailItem item;
item = Isolate.Fake.Instance<MailItem> ();}}}

The class being faked is Microsoft.Exchange.Data.Transport.MailItem by Microsoft version 8.0.681.0 I obviously won't be able to use InternalsVisibleTo since this is a third party assembly.

Is there any way for TypeMock to mock this class?
asked by clemahieu (640 points)

3 Answers

0 votes
Hi,

It appears to be a bug, but we will install Exchange Server and check it out...
We will post here when we figure it out.

Regards,
Yonatan,
TypeMock Support Group
answered by yonatan (1.6k points)
0 votes
Let me know if additional information is needed to fix this issue.
answered by clemahieu (640 points)
0 votes
I also faced this problem with MailItem class.
As this class is an abstract class with some of the properties as internal, hence we cannot create a concrete class from it in our dll.

I got around that problem by creating a wrapper over it my production code, and in test code I was able to Fake my own wrapper.
answered by manishkp (140 points)
...