forked from dataplat/dbatools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisconnect-DbaInstance.Tests.ps1
27 lines (24 loc) · 1.13 KB
/
Disconnect-DbaInstance.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
26
27
$CommandName = $MyInvocation.MyCommand.Name.Replace(".Tests.ps1", "")
Write-Host -Object "Running $PSCommandpath" -ForegroundColor Cyan
. "$PSScriptRoot\constants.ps1"
Describe "$CommandName Unit Tests" -Tag "UnitTests" {
Context "Validate parameters" {
[array]$params = ([Management.Automation.CommandMetaData]$ExecutionContext.SessionState.InvokeCommand.GetCommand($CommandName, 'Function')).Parameters.Keys
[object[]]$knownParameters = 'InputObject', 'EnableException'
It "Should only contain our specific parameters" {
Compare-Object -ReferenceObject $knownParameters -DifferenceObject $params | Should -BeNullOrEmpty
}
}
}
Describe "$commandname Integration Tests" -Tag "IntegrationTests" {
BeforeAll {
$null = Get-DbaDatabase -SqlInstance $script:instance1
$null = Connect-DbaInstance -SqlInstance $env:COMPUTERNAME -SqlConnectionOnly
}
Context "disconnets a server" {
It "disconnects and returns some results" {
$results = Get-DbaConnectedInstance | Disconnect-DbaInstance
$results.Count | Should -BeGreaterThan 1
}
}
}