I have written a Program who call an external DLL-Method from the Device-Manufacturer. This Methods (round about 600) makes an Ethernet Connection to a Device. The Methods looks like this:
[DllImport("Libary.dll", EntryPoint = "methode1")]
public static extern short methode1(ushort Handl,
short a, short b, short c, short d, [Out, MarshalAs(UnmanagedType.LPStruct)] SpecialStruct1 e);
and this:
[DllImport("Libary.dll", EntryPoint = "methode2")]
public static extern short methode2(ushort Handl, short a, int b);
Now I want to write Unit-Test for my Code and want to mock the DLL-Methods. The DLL is written in C and with the Library has come a C# file (See Methods above). My Methods looks like this:
public int myMethode1(ushort handl, List<object> parameters)
{
int a = (int)parameters[1];
string b = (string)parameters[2];
return Libary1.Methode1(handl, ref a, b);
}
Can you tell me how to write a Mock für this external DLL? How can I Test my Methods without the Device? Witch tools can help me?