Update For Pester Tests
This commit is contained in:
@@ -16,4 +16,29 @@ Describe $file.BaseName -Tag 'Unit' {
|
||||
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
|
||||
$errors | Should -HaveCount 0
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Parameter Unit Tests" {
|
||||
|
||||
it "Supports 'ShouldProcess'" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter WhatIf
|
||||
Get-Command $file.BaseName | Should -HaveParameter Confirm
|
||||
$file | Should -FileContentMatch 'SupportsShouldProcess'
|
||||
$file | Should -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
|
||||
it "has a mandatory string parameter for the vpgName" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName -Type string[]
|
||||
Get-Command $file.BaseName | Should -HaveParameter vpgName -Mandatory
|
||||
}
|
||||
|
||||
it "has a switch parameter for reverse protection" {
|
||||
Get-Command $file.BaseName | Should -HaveParameter reverseProtection
|
||||
Get-Command $file.BaseName | Should -HaveParameter reverseProtection -Type switch
|
||||
}
|
||||
}
|
||||
|
||||
Context "$($file.BaseName)::Function Unit Tests" {
|
||||
#TODO
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user