Skip to content

Commit

Permalink
old-style param check (do Invoke-DbaQuery)
Browse files Browse the repository at this point in the history
  • Loading branch information
niphlod committed Oct 21, 2024
1 parent ad134f0 commit 29de0e4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/Invoke-DbaQuery.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ BeforeAll {

Describe "$CommandName Unit Tests" -Tag 'UnitTests' {
Context "Validate parameters" {
[object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object { $_ -notin ('whatif', 'confirm') }
[object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Query', 'QueryTimeout', 'File', 'SqlObject', 'As', 'SqlParameter', 'AppendServerInstance', 'MessagesToOutput', 'InputObject', 'ReadOnly', 'EnableException', 'CommandType', 'NoExec'
$knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters
BeforeAll {
$command = Get-Command Invoke-DbaQuery
}
It "Should only contain our specific parameters" {
(@(Compare-Object -ReferenceObject ($knownParameters | Where-Object { $_ }) -DifferenceObject $params).Count ) | Should Be 0
[object[]]$params = $command.Parameters.Keys | Where-Object { $_ -notin ('whatif', 'confirm') }
[object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'Query', 'QueryTimeout', 'File', 'SqlObject', 'As', 'SqlParameter', 'AppendServerInstance', 'MessagesToOutput', 'InputObject', 'ReadOnly', 'EnableException', 'CommandType', 'NoExec'
$knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters
(@(Compare-Object -ReferenceObject ($knownParameters | Where-Object { $_ }) -DifferenceObject $params).Count ) | Should -Be 0
}
}
Context "Validate alias" {
Expand Down

0 comments on commit 29de0e4

Please sign in to comment.