Describe"$commandname Integration Tests"-Tags"IntegrationTests"{Context"Command actually works"{$instanceName=(Connect-SqlInstance-SqlInstance$script:instance2).ServiceName$results=Get-DbaSqlService-ComputerName$script:instance2It"shows some services"{$results.DisplayName|ShouldNotBe$null}$results=Get-DbaSqlService-ComputerName$script:instance2-TypeAgentIt"shows only one service type"{foreach($resultin$results){$result.DisplayName-match"Agent"|ShouldBe$true}}

$results=Get-DbaSqlService-ComputerName$script:instance2-InstanceName$instanceName-TypeAgentIt"shows a service from a specific instance"{$results.ServiceType|ShouldBe"Agent"}$service=Get-DbaSqlService-ComputerName$script:instance2-TypeAgent-InstanceName$instanceNameIt"sets startup mode of the service to 'Manual'"{{$service.ChangeStartMode('Manual')}|ShouldNotThrow}$results=Get-DbaSqlService-ComputerName$script:instance2-TypeAgent-InstanceName$instanceNameIt"verifies that startup mode of the service is 'Manual'"{$results.StartMode|ShouldBe'Manual'}$service=Get-DbaSqlService-ComputerName$script:instance2-TypeAgent-InstanceName$instanceNameIt"sets startup mode of the service to 'Automatic'"{{$service.ChangeStartMode('Automatic')}|ShouldNotThrow}$results=Get-DbaSqlService-ComputerName$script:instance2-TypeAgent-InstanceName$instanceNameIt"verifies that startup mode of the service is 'Automatic'"{$results.StartMode|ShouldBe'Automatic'}}}