Hi,
is it possible to mock P/Invoke (Windows API) calls using JustMock commercial edition? I have a helper class which uses a few APIs from advapi32.dll and kernel32.dll to log-on to a remote file share and would like to unit test it and assert whether the right APIs were called with the right parameters.
E.g. the API
is called in my code and I'd like to assert that the correct user name, domain, password etc. were passed to it.
Regards, Robert
is it possible to mock P/Invoke (Windows API) calls using JustMock commercial edition? I have a helper class which uses a few APIs from advapi32.dll and kernel32.dll to log-on to a remote file share and would like to unit test it and assert whether the right APIs were called with the right parameters.
E.g. the API
[DllImport(
"advapi32.dll"
, SetLastError =
true
)]
>
private
static
extern
bool
LogonUser(
string
lpszUsername,
string
lpszDomain,
string
lpszPassword,
int
dwLogonType,
int
dwLogonProvider,
ref
IntPtr phToken);
is called in my code and I'd like to assert that the correct user name, domain, password etc. were passed to it.
Regards, Robert