Skip to content
Permalink
Browse files

Conect-DbaInstance tests (#5209)

* add tests
  • Loading branch information...
potatoqualitee committed Mar 15, 2019
1 parent 763ebaa commit 0f43c35637c34d6752c3efdf06f6c46fd111ba92
Showing with 17 additions and 7 deletions.
  1. +17 −7 tests/Connect-DbaInstance.Tests.ps1
@@ -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'
}
}
}

0 comments on commit 0f43c35

Please sign in to comment.
You can’t perform that action at this time.