Skip to content

Instantly share code, notes, and snippets.

@bielawb
Created December 28, 2020 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bielawb/f065ddf2e29a05917f62f864290f4e44 to your computer and use it in GitHub Desktop.
Save bielawb/f065ddf2e29a05917f62f864290f4e44 to your computer and use it in GitHub Desktop.
Testowanie zachowania gdy polecenie zwróci błąd
It 'Zwraca błąd z info o problemach w Invoke-RestMethod' {
Mock -CommandName Invoke-RestMethod -MockWith {
Write-Error 'Błąd!'
}
{
Get-PowerShellPLPost -ErrorAction Stop
} | Should -Throw -ExpectedMessage 'Coś poszło nie tak... Błąd!'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment