Skip to content

Instantly share code, notes, and snippets.

@nohwnd
Created December 23, 2019 13:08
Show Gist options
  • Save nohwnd/5e8ff93281e3de98b2a6110322129827 to your computer and use it in GitHub Desktop.
Save nohwnd/5e8ff93281e3de98b2a6110322129827 to your computer and use it in GitHub Desktop.
Compound assertions example
Describe "In Pester v5 assertions don't fail by default" {
It "is awesome for ensuring a lot of stuff about single object" {
$user = @{
Name = 'Jakub'
Age = 31
Languages = [PSCustomObject]@{
Speaking = 'Czech', 'English'
Programming = @(
'C#'
'PowerShell'
'F#'
'go'
'TypeScript'
)
}
}
$user | Should -Not -BeNullOrEmpty -ErrorAction Stop
$user.Name | Should -Be 'Tomas'
$user.Age | Should -Be 27
$user.Languages.Speaking.Count | Should -Be 3
$user.Languages.Speaking | Should -Contain 'Portugese'
$user.Languages.Speaking | Should -Contain 'German'
$user.Languages.Speaking | Should -Contain 'Russian'
$user.Languages.Programming | Should -Be @(
"Erlang"
"Java"
"Agda"
"Coq"
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment