Skip to content

Commit 4e55b14

Browse files
committed
Add parameter validation test for Get-SqlDscRSPackage to ensure correct parameter sets
1 parent 0f69d54 commit 4e55b14

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Unit/Public/Get-SqlDscRSPackage.Tests.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,23 @@ Describe 'Get-SqlDscRSPackage' -Tag 'Public' {
161161
}
162162

163163
Context 'Parameter validation' {
164+
It 'Should have the correct parameters in parameter set __AllParameterSets' -ForEach @(
165+
@{
166+
ExpectedParameterSetName = '__AllParameterSets'
167+
ExpectedParameters = '[-FilePath] <String> [-Force] [<CommonParameters>]'
168+
}
169+
) {
170+
$result = (Get-Command -Name 'Get-SqlDscRSPackage').ParameterSets |
171+
Where-Object -FilterScript { $_.Name -eq $ExpectedParameterSetName } |
172+
Select-Object -Property @(
173+
@{ Name = 'ParameterSetName'; Expression = { $_.Name } },
174+
@{ Name = 'ParameterListAsString'; Expression = { $_.ToString() } }
175+
)
176+
177+
$result.ParameterSetName | Should -Be $ExpectedParameterSetName
178+
$result.ParameterListAsString | Should -Be $ExpectedParameters
179+
}
180+
164181
It 'Should have the correct parameters' {
165182
$commandInfo = Get-Command -Name 'Get-SqlDscRSPackage'
166183

0 commit comments

Comments
 (0)