File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,10 +40,12 @@ Describe 'Test HTTP Find-PSResource for ACR Server Protocol' -tags 'CI' {
4040 It " Find resource given specific Name, Version null" {
4141 # FindName()
4242 Write-Verbose - Verbose " Finding resource with Name: $testModuleName "
43- $res = Find-PSResource - Name $testModuleName - Repository $ACRRepoName - Verbose - Debug - ErrorAction Stop
4443
45- if ($Error.Count -gt 0 ) {
46- Write-Error " Error occurred while finding resource: $ ( $Error [0 ]) "
44+ try {
45+ $res = Find-PSResource - Name $testModuleName - Repository $ACRRepoName - Verbose - Debug - ErrorAction Stop
46+ }
47+ catch {
48+ Write-Error " Error occurred while finding resource: $_ "
4749 Get-Error
4850 }
4951
@@ -54,6 +56,7 @@ Describe 'Test HTTP Find-PSResource for ACR Server Protocol' -tags 'CI' {
5456
5557 It " Should not find resource given nonexistant Name" {
5658 # FindName()
59+ Write-Verbose - Verbose " Moved to the next test case to find non-existant resource"
5760 $res = Find-PSResource - Name NonExistantModule - Repository $ACRRepoName - ErrorVariable err - ErrorAction SilentlyContinue
5861 $res | Should - BeNullOrEmpty
5962 $err.Count | Should - BeGreaterThan 0
You can’t perform that action at this time.
0 commit comments