Skip to content

Instantly share code, notes, and snippets.

@nohwnd
Created May 4, 2015 12:20
Show Gist options
  • Save nohwnd/0eb191e16102bbdf5b7d to your computer and use it in GitHub Desktop.
Save nohwnd/0eb191e16102bbdf5b7d to your computer and use it in GitHub Desktop.
Mocking Write-Warning
function DoSomething
{
Write-Warning "problem with the server certificate"
}
Describe 'Test warning' {
Mock Write-Warning { $Message }
It 'Writes warning' {
DoSomething
Assert-MockCalled Write-Warning -Exactly 1 -ParameterFilter {
$Message -eq "problem with the server certificate"}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment