Skip to content

Commit

Permalink
Conect-DbaInstance tests (#5209)
Browse files Browse the repository at this point in the history
* add tests
  • Loading branch information
potatoqualitee committed Mar 15, 2019
1 parent 763ebaa commit 0f43c35
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions tests/Connect-DbaInstance.Tests.ps1
Expand Up @@ -20,19 +20,29 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" {
$cred = New-Object System.Management.Automation.PSCredential ($script:azuresqldblogin, $securePassword)

It "Should login to Azure" {
$s = Connect-DbaInstance -SqlInstance $script:azureserver -SqlCredential $cred -Database test
$s.Name | Should -match $script:azureserver
$s = Connect-DbaInstance -SqlInstance psdbatools.database.windows.net -SqlCredential $cred -Database test
$s.Name | Should -match 'psdbatools.database.windows.net'
$s.DatabaseEngineType | Should -Be 'SqlAzureDatabase'
}

It -Skip "Should keep the same database context" {
$results = Invoke-DbaQuery -SqlInstance $s -Query "select db_name()"
$results | Should -Be 'test'
It "Should keep the same database context" {
$s = Connect-DbaInstance -SqlInstance psdbatools.database.windows.net -SqlCredential $cred -Database test
$results = Invoke-DbaQuery -SqlInstance $s -Query "select db_name() as dbname"
$results.dbname | Should -Be 'test'
}

It -Skip "Should keep the same database context" {
It "Should keep the same database context again" {
$s = Connect-DbaInstance -SqlInstance psdbatools.database.windows.net -SqlCredential $cred -Database test
$results = Invoke-DbaQuery -SqlInstance $s -Query "select db_name() as dbname"
$results.dbname | Should -Be 'test'
$results = Invoke-DbaQuery -SqlInstance $s -Query "select db_name() as dbname"
$results.dbname | Should -Be 'test'
}

It "Should keep the same database context" {
$s = Connect-DbaInstance -SqlInstance psdbatools.database.windows.net -SqlCredential $cred -Database test
$server = Connect-DbaInstance -SqlInstance $s
$server.Query("select db_name()") | Should -Be 'test'
$server.Query("select db_name() as dbname").dbname | Should -Be 'test'
}
}
}
Expand Down

0 comments on commit 0f43c35

Please sign in to comment.