解決されたパラメーター セットの「高度な」関数をチェックする基本的な Pester テストを作成しようとしています。
function Do-Stuff
{
[CmdletBinding(DefaultParameterSetName='Set 1')]
[OutputType([String])]
Param
(
[Parameter(ParameterSetName='Set 1')]
[switch]
$S1,
[Parameter(ParameterSetName='Set 2')]
[switch]
$S2
)
$PSBoundParameters |select -ExpandProperty Keys
}
Describe Do-Stuff {
It 'Returns "S2" when switch "S2" is set' {
$actual = Do-Stuff -S2
$expexted = 'S2'
$actual |Should Be $expexted
}
# How to test the resolved parameter set?
It 'The resolved parameter set is "Set 2" when switch "S2" is set' {
$actual = 'What to do here?' # I'm lost ;(
$expexted = 'Set 2'
$actual |Should Be $expexted
}
}
ありがとう。私はペスターにまったく慣れていないので、アドバイスをいただければ幸いです。...一般的には、上品でコーディングもそれほど良くありません:D