diff --git a/src/Helper/Test-Module.ps1 b/src/Helper/Test-Module.ps1 index 75d7720..70afa70 100644 --- a/src/Helper/Test-Module.ps1 +++ b/src/Helper/Test-Module.ps1 @@ -89,8 +89,8 @@ Could not find the required {0} called {1}. Please install the required {0} to r else { if ($StopIfFails) { Write-Error -Message $Message -ErrorAction Stop -Category NotInstalled - return $false } + return $false } } diff --git a/tests/Helper/01_Test-Module.Tests.ps1 b/tests/Helper/01_Test-Module.Tests.ps1 index e0cdec0..22f9181 100644 --- a/tests/Helper/01_Test-Module.Tests.ps1 +++ b/tests/Helper/01_Test-Module.Tests.ps1 @@ -32,7 +32,8 @@ Describe "Test-ModuleName" { } Context "Working with PSSnapins" { It "Loading first PSSnaping should not throw " { - $Snap = Get-PSSnapin -Registered | Select-Object -First 1 + $Snap = Get-PSSnapin -Registered + $Snap { $loaded = Test-Module -Name $Snap.Name -Type PSSnapin } | Should -Not -Throw Remove-PSSnapin -Name $Snap.Name }