2020-03-24 19:08:37 +01:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
2018-02-13 18:23:53 +01:00
|
|
|
# Licensed under the MIT License.
|
2017-09-30 01:28:15 +02:00
|
|
|
Describe "Attribute tests" -Tags "CI" {
|
|
|
|
BeforeEach {
|
|
|
|
Remove-Item $testdrive/test.ps1 -Force -ErrorAction SilentlyContinue
|
|
|
|
}
|
|
|
|
|
|
|
|
It "<attribute> attribute returns argument error if empty" -TestCases @(
|
|
|
|
@{Attribute="HelpMessage"},
|
|
|
|
@{Attribute="HelpMessageBaseName"},
|
|
|
|
@{Attribute="HelpMessageResourceId"}
|
|
|
|
) {
|
|
|
|
param($attribute)
|
|
|
|
|
|
|
|
$script = @"
|
|
|
|
[CmdletBinding()]
|
|
|
|
Param (
|
|
|
|
[Parameter($attribute="")]
|
|
|
|
[String]`$Parameter1
|
|
|
|
)
|
|
|
|
Write-Output "Hello"
|
|
|
|
"@
|
|
|
|
New-Item -Path $testdrive/test.ps1 -Value $script -ItemType File
|
2018-05-17 23:42:04 +02:00
|
|
|
{ & $testdrive/test.ps1 } | Should -Throw -ErrorId "Argument"
|
2017-09-30 01:28:15 +02:00
|
|
|
}
|
|
|
|
}
|