tests/Get-DbaDatabase.Tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan
Describe "Get-DbaDatabase Integration Tests" -Tags "IntegrationTests" {

    Context "Count system databases on localhost" {
        $results = Get-DbaDatabase -SqlInstance localhost -NoUserDb 
        It "Should report the right number of databases" {
            $results.Count | Should Be 4
        }
    }

    Context "Check that master database is in Simple recovery mode" {
        $results = Get-DbaDatabase -SqlInstance localhost -Database master
        It "Should say the recovery mode of master is Simple" {
            $results.RecoveryModel | Should Be "Simple"
        }
    }
    
    Context "Check that master database is accessible" {
        $results = Get-DbaDatabase -SqlInstance localhost -Database master
        It "Should return true that master is accessible" {
            $results.IsAccessible | Should Be $true
        }
    }
}