tests/Get-DbaSqlService.Tests.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$commandname = $MyInvocation.MyCommand.Name.Replace(".ps1", "")
Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan
. "$PSScriptRoot\constants.ps1"

Describe "$commandname Integration Tests" -Tags "IntegrationTests" {
    
    Context "Command actually works" {
        $results = Get-DbaSqlService -ComputerName $script:instance1, $script:instance2
        
        It "shows some services" {
            $results.DisplayName | Should Not Be $null
        }
        
        $results = Get-DbaSqlService -ComputerName $script:instance1 -Type Agent
        
        It "shows only one type of service" {
            foreach ($result in $results) {
                $result.DisplayName -match "Agent" | Should Be $true
            }
        }
    }
}