diff --git a/Tests/Integration/MSFT_SqlServerRole.Integration.Tests.ps1 b/Tests/Integration/MSFT_SqlServerRole.Integration.Tests.ps1 index 1b0712bb6..9b4a470ed 100644 --- a/Tests/Integration/MSFT_SqlServerRole.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_SqlServerRole.Integration.Tests.ps1 @@ -74,13 +74,13 @@ try } It 'Should be able to call Get-DscConfiguration without throwing' { - { Get-DscConfiguration -Verbose -ErrorAction Stop } | Should -Not -Throw + { + $script:currentConfiguration = Get-DscConfiguration -Verbose -ErrorAction Stop + } | Should -Not -Throw } It 'Should have set the resource and all the parameters should match' { - $currentConfiguration = Get-DscConfiguration - - $resourceCurrentState = $currentConfiguration | Where-Object -FilterScript { + $resourceCurrentState = $script:currentConfiguration | Where-Object -FilterScript { $_.ConfigurationName -eq $configurationName } | Where-Object -FilterScript { $_.ResourceId -eq $resourceId @@ -121,10 +121,14 @@ try } | Should -Not -Throw } - It 'Should have set the resource and all the parameters should match' { - $currentConfiguration = Get-DscConfiguration + It 'Should be able to call Get-DscConfiguration without throwing' { + { + $script:currentConfiguration = Get-DscConfiguration -Verbose -ErrorAction Stop + } | Should -Not -Throw + } - $resourceCurrentState = $currentConfiguration | Where-Object -FilterScript { + It 'Should have set the resource and all the parameters should match' { + $resourceCurrentState = $script:currentConfiguration | Where-Object -FilterScript { $_.ConfigurationName -eq $configurationName } | Where-Object -FilterScript { $_.ResourceId -eq $resourceId @@ -165,10 +169,14 @@ try } | Should -Not -Throw } - It 'Should have set the resource and all the parameters should match' { - $currentConfiguration = Get-DscConfiguration + It 'Should be able to call Get-DscConfiguration without throwing' { + { + $script:currentConfiguration = Get-DscConfiguration -Verbose -ErrorAction Stop + } | Should -Not -Throw + } - $resourceCurrentState = $currentConfiguration | Where-Object -FilterScript { + It 'Should have set the resource and all the parameters should match' { + $resourceCurrentState = $script:currentConfiguration | Where-Object -FilterScript { $_.ConfigurationName -eq $configurationName } | Where-Object -FilterScript { $_.ResourceId -eq $resourceId @@ -212,10 +220,14 @@ try } | Should -Not -Throw } - It 'Should have set the resource and all the parameters should match' { - $currentConfiguration = Get-DscConfiguration + It 'Should be able to call Get-DscConfiguration without throwing' { + { + $script:currentConfiguration = Get-DscConfiguration -Verbose -ErrorAction Stop + } | Should -Not -Throw + } - $resourceCurrentState = $currentConfiguration | Where-Object -FilterScript { + It 'Should have set the resource and all the parameters should match' { + $resourceCurrentState = $script:currentConfiguration | Where-Object -FilterScript { $_.ConfigurationName -eq $configurationName } | Where-Object -FilterScript { $_.ResourceId -eq $resourceId @@ -259,10 +271,14 @@ try } | Should -Not -Throw } - It 'Should have set the resource and all the parameters should match' { - $currentConfiguration = Get-DscConfiguration + It 'Should be able to call Get-DscConfiguration without throwing' { + { + $script:currentConfiguration = Get-DscConfiguration -Verbose -ErrorAction Stop + } | Should -Not -Throw + } - $resourceCurrentState = $currentConfiguration | Where-Object -FilterScript { + It 'Should have set the resource and all the parameters should match' { + $resourceCurrentState = $script:currentConfiguration | Where-Object -FilterScript { $_.ConfigurationName -eq $configurationName } | Where-Object -FilterScript { $_.ResourceId -eq $resourceId @@ -311,10 +327,14 @@ try } | Should -Not -Throw } - It 'Should have set the resource and all the parameters should match' { - $currentConfiguration = Get-DscConfiguration + It 'Should be able to call Get-DscConfiguration without throwing' { + { + $script:currentConfiguration = Get-DscConfiguration -Verbose -ErrorAction Stop + } | Should -Not -Throw + } - $resourceCurrentState = $currentConfiguration | Where-Object -FilterScript { + It 'Should have set the resource and all the parameters should match' { + $resourceCurrentState = $script:currentConfiguration | Where-Object -FilterScript { $_.ConfigurationName -eq $configurationName } | Where-Object -FilterScript { $_.ResourceId -eq $resourceId @@ -359,13 +379,13 @@ try } It 'Should be able to call Get-DscConfiguration without throwing' { - { Get-DscConfiguration -Verbose -ErrorAction Stop } | Should -Not -Throw + { + $script:currentConfiguration = Get-DscConfiguration -Verbose -ErrorAction Stop + } | Should -Not -Throw } It 'Should have set the resource and all the parameters should match' { - $currentConfiguration = Get-DscConfiguration - - $resourceCurrentState = $currentConfiguration | Where-Object -FilterScript { + $resourceCurrentState = $script:currentConfiguration | Where-Object -FilterScript { $_.ConfigurationName -eq $configurationName } | Where-Object -FilterScript { $_.ResourceId -eq $resourceId