diff --git a/tests/Copy-DbaDbMail.Tests.ps1 b/tests/Copy-DbaDbMail.Tests.ps1 index a7e215a629..494007e91e 100644 --- a/tests/Copy-DbaDbMail.Tests.ps1 +++ b/tests/Copy-DbaDbMail.Tests.ps1 @@ -76,10 +76,10 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { foreach ($r in $results) { if ($r.type -in @('Mail Configuration', 'Mail Account', 'Mail Profile')) { It "Should have copied $($r.type) from $($TestConfig.instance2)" { - $r.SourceServer | Should Be "$($TestConfig.instance2)" + $r.SourceServer | Should Be $TestConfig.instance2 } It "Should have copied $($r.type) to $($TestConfig.instance3)" { - $r.DestinationServer | Should Be "$($TestConfig.instance3)" + $r.DestinationServer | Should Be $TestConfig.instance3 } } } @@ -94,11 +94,11 @@ Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { foreach ($r in $results) { It "Should have $($r.status) $($r.type) from $($TestConfig.instance2)" { - $r.SourceServer | Should Be "$($TestConfig.instance2)" + $r.SourceServer | Should Be $TestConfig.instance2 $r.status | Should Be 'Skipped' } It "Should have $($r.status) $($r.type) to $($TestConfig.instance3)" { - $r.DestinationServer | Should Be "$($TestConfig.instance3)" + $r.DestinationServer | Should Be $TestConfig.instance3 $r.status | Should Be 'Skipped' } } diff --git a/tests/Get-DbaLinkedServer.Tests.ps1 b/tests/Get-DbaLinkedServer.Tests.ps1 index fe5b0bd4d7..b1adf595f7 100644 --- a/tests/Get-DbaLinkedServer.Tests.ps1 +++ b/tests/Get-DbaLinkedServer.Tests.ps1 @@ -17,11 +17,11 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { BeforeAll { $server = Connect-DbaInstance -SqlInstance $TestConfig.instance2 $null = $server.Query("EXEC master.dbo.sp_addlinkedserver - @server = N'$TestConfig.instance3', + @server = N'$($TestConfig.instance3)', @srvproduct=N'SQL Server' ;") } AfterAll { - $null = $server.Query("EXEC master.dbo.sp_dropserver '$TestConfig.instance3', 'droplogins'; ") + $null = $server.Query("EXEC master.dbo.sp_dropserver '$($TestConfig.instance3)', 'droplogins'; ") } Context "Gets Linked Servers" { @@ -30,7 +30,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { $results | Should Not Be $null } It "Should have Remote Server of $($TestConfig.instance3)" { - $results.RemoteServer | Should Be "$($TestConfig.instance3)" + $results.RemoteServer | Should Be $TestConfig.instance3 } It "Should have a product name of SQL Server" { $results.productname | Should Be 'SQL Server' @@ -40,12 +40,12 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } } Context "Gets Linked Servers using -LinkedServer" { - $results = Get-DbaLinkedServer -SqlInstance $TestConfig.instance2 -LinkedServer "$($TestConfig.instance3)" + $results = Get-DbaLinkedServer -SqlInstance $TestConfig.instance2 -LinkedServer $TestConfig.instance3 It "Gets results" { $results | Should Not Be $null } It "Should have Remote Server of $($TestConfig.instance3)" { - $results.RemoteServer | Should Be "$($TestConfig.instance3)" + $results.RemoteServer | Should Be $TestConfig.instance3 } It "Should have a product name of SQL Server" { $results.productname | Should Be 'SQL Server' @@ -55,7 +55,7 @@ Describe "$commandname Integration Tests" -Tags "IntegrationTests" { } } Context "Gets Linked Servers using -ExcludeLinkedServer" { - $results = Get-DbaLinkedServer -SqlInstance $TestConfig.instance2 -ExcludeLinkedServer "$($TestConfig.instance3)" + $results = Get-DbaLinkedServer -SqlInstance $TestConfig.instance2 -ExcludeLinkedServer $TestConfig.instance3 It "Gets results" { $results | Should Be $null } diff --git a/tests/Start-DbaPfDataCollectorSet.Tests.ps1 b/tests/Start-DbaPfDataCollectorSet.Tests.ps1 index a16d336290..a957c93f73 100644 --- a/tests/Start-DbaPfDataCollectorSet.Tests.ps1 +++ b/tests/Start-DbaPfDataCollectorSet.Tests.ps1 @@ -15,16 +15,16 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { BeforeAll { - $TestConfig.set = Get-DbaPfDataCollectorSet | Select-Object -First 1 - $TestConfig.set | Stop-DbaPfDataCollectorSet -WarningAction SilentlyContinue + $script:set = Get-DbaPfDataCollectorSet | Select-Object -First 1 + $script:set | Stop-DbaPfDataCollectorSet -WarningAction SilentlyContinue Start-Sleep 2 } AfterAll { - $TestConfig.set | Stop-DbaPfDataCollectorSet -WarningAction SilentlyContinue + $script:set | Stop-DbaPfDataCollectorSet -WarningAction SilentlyContinue } Context "Verifying command works" { It "returns a result with the right computername and name is not null" { - $results = $TestConfig.set | Select-Object -First 1 | Start-DbaPfDataCollectorSet -WarningAction SilentlyContinue -WarningVariable warn + $results = $script:set | Select-Object -First 1 | Start-DbaPfDataCollectorSet -WarningAction SilentlyContinue -WarningVariable warn if (-not $warn) { $results.ComputerName | Should Be $env:COMPUTERNAME $results.Name | Should Not Be $null diff --git a/tests/Stop-DbaPfDataCollectorSet.Tests.ps1 b/tests/Stop-DbaPfDataCollectorSet.Tests.ps1 index 374f52b1b1..631c84e32b 100644 --- a/tests/Stop-DbaPfDataCollectorSet.Tests.ps1 +++ b/tests/Stop-DbaPfDataCollectorSet.Tests.ps1 @@ -15,16 +15,16 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' { Describe "$CommandName Integration Tests" -Tags "IntegrationTests" { BeforeAll { - $TestConfig.set = Get-DbaPfDataCollectorSet | Select-Object -First 1 - $TestConfig.set | Start-DbaPfDataCollectorSet -WarningAction SilentlyContinue + $script:set = Get-DbaPfDataCollectorSet | Select-Object -First 1 + $script:set | Start-DbaPfDataCollectorSet -WarningAction SilentlyContinue Start-Sleep 2 } AfterAll { - $TestConfig.set | Stop-DbaPfDataCollectorSet -WarningAction SilentlyContinue + $script:set | Stop-DbaPfDataCollectorSet -WarningAction SilentlyContinue } Context "Verifying command works" { It "returns a result with the right computername and name is not null" { - $results = $TestConfig.set | Select-Object -First 1 | Stop-DbaPfDataCollectorSet -WarningAction SilentlyContinue -WarningVariable warn + $results = $script:set | Select-Object -First 1 | Stop-DbaPfDataCollectorSet -WarningAction SilentlyContinue -WarningVariable warn if (-not $warn) { $results.ComputerName | Should Be $env:COMPUTERNAME $results.Name | Should Not Be $null