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,
Does Isolator supports mocking a dllimport methods?
methods like:
[DllImport("systab.dll", /*CharSet = CharSet.Ansi,*/ EntryPoint = "sysTabTopicToString", CallingConvention = CallingConvention.Cdecl, BestFitMapping = false, ThrowOnUnmappableChar = true)]
public extern static int sysTabTopicToString(int topic, [MarshalAs(UnmanagedType.LPStr)] StringBuilder pTopicString, int maxLen);

if it does is there anythign special i need to do?
asked by error (6.6k points)

1 Answer

0 votes
Hi Lior,

Faking an extern method directly is not supported.

As a workaround, if you're calling the extern from your own code, you can wrap the call by:

public static int InternalSysTabTopicToString(int topic, StringBuilder pTopicString, int maxLen)
{
   return sysTabTopicToString(topic, pTopicString, maxLen);
}


And fake the behavior on the wrapper call.

Regards,
Elisha,
Typemock Support
answered by Elisha (12k points)
...