Skip to content

Commit

Permalink
Get-DbaDbCompatibility: Add DatabaseId to the return object (dataplat…
Browse files Browse the repository at this point in the history
  • Loading branch information
lancasteradam authored Oct 30, 2022
1 parent 2ce2c86 commit 3700049
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions functions/Get-DbaDbCompatibility.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function Get-DbaDbCompatibility {
InstanceName = $server.ServiceName
SqlInstance = $server.DomainInstanceName
Database = $db.Name
DatabaseId = $db.Id
Compatibility = $db.CompatibilityLevel
}
}
Expand Down
6 changes: 4 additions & 2 deletions tests/Get-DbaDbCompatibility.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan

Describe "$CommandName Unit Tests" -Tag 'UnitTests' {
Context "Validate parameters" {
[object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object {$_ -notin ('whatif', 'confirm')}
[object[]]$params = (Get-Command $CommandName).Parameters.Keys | Where-Object { $_ -notin ('whatif', 'confirm') }
[object[]]$knownParameters = 'SqlInstance', 'SqlCredential', 'Database', 'InputObject', 'EnableException'
$knownParameters += [System.Management.Automation.PSCmdlet]::CommonParameters
It "Should only contain our specific parameters" {
(@(Compare-Object -ReferenceObject ($knownParameters | Where-Object {$_}) -DifferenceObject $params).Count ) | Should Be 0
(@(Compare-Object -ReferenceObject ($knownParameters | Where-Object { $_ }) -DifferenceObject $params).Count ) | Should Be 0
}
}
}
Expand All @@ -22,6 +22,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" {
Foreach ($row in $results) {
It "Should return Compatiblity level of Version100 for $($row.database)" {
$row.Compatibility | Should Be "Version100"
$row.DatabaseId | Should -Be (Get-DbaDatabase -SqlInstance $script:instance1 -Database $row.Database).Id
}
}
}
Expand All @@ -33,6 +34,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" {
}
It "Should return Compatiblity level of Version100 for $($results.database)" {
$results.Compatibility | Should Be "Version100"
$results.DatabaseId | Should -Be (Get-DbaDatabase -SqlInstance $script:instance1 -Database master).Id
}
}
}

0 comments on commit 3700049

Please sign in to comment.