Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gerane/5cb6d6e3b1c1419b6ffec29cb4cdc764 to your computer and use it in GitHub Desktop.
Save gerane/5cb6d6e3b1c1419b6ffec29cb4cdc764 to your computer and use it in GitHub Desktop.
Faking call to external static method in Pester
add-type -TypeDefinition @"
using System;
public static class KeyboardEventTestUtil {
public static string keybd_event(byte bVk, byte bScan, UInt32 dwFlags, System.UIntPtr dwExtraInfo) {
return string.Format("{0}:{1}:{2}:{3}", bVk,bScan,dwFlags,dwExtraInfo);
}
}
"@
describe "t" {
it "b" {
[KeyboardEventTestUtil]::keybd_event(1,1,1,[UIntPtr]::Zero) | should be "1:1:1:0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment