diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 index d877c893283..16d772a98e6 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 @@ -200,7 +200,7 @@ try Invoke-Command $session { Set-Alias BrokenAlias NonExistantCommand } $module = Import-PSSession $session -CommandName:BrokenAlias -CommandType:All -ErrorAction SilentlyContinue -ErrorVariable expectedError -AllowClobber - $expectedError | Should -Not -Be NullOrEmpty + $expectedError | Should -Not -BeNullOrEmpty $expectedError[0].ToString().Contains("BrokenAlias") | Should -BeTrue } finally { if ($null -ne $module) { Remove-Module $module -Force -ErrorAction SilentlyContinue } @@ -344,7 +344,7 @@ try Export-PSSession -Session $session -CommandName Get-Variable -AllowClobber -ModuleName $file -EA SilentlyContinue -ErrorVariable expectedError } catch { } - $expectedError | Should -Not -Be NullOrEmpty + $expectedError | Should -Not -BeNullOrEmpty # Error contains reference to the directory that already exists ([string]($expectedError[0]) -like "*$file*") | Should -BeTrue } @@ -377,7 +377,7 @@ try It "Verfies Remove-Module doesn't remove user's runspace" { Remove-Module $module -Force -ErrorAction SilentlyContinue - (Get-PSSession -InstanceId $session.InstanceId) | Should -Not -Be NullOrEmpty + (Get-PSSession -InstanceId $session.InstanceId) | Should -Not -BeNullOrEmpty } } } @@ -764,11 +764,11 @@ try } It "Import-PSSession should return a PSModuleInfo object" { - $module | Should -Not -Be NullOrEmpty + $module | Should -Not -BeNullOrEmpty } It "Import-PSSession should return a PSModuleInfo object" { - ($module -as [System.Management.Automation.PSModuleInfo]) | Should -Not -Be NullOrEmpty + ($module -as [System.Management.Automation.PSModuleInfo]) | Should -Not -BeNullOrEmpty } It "Helper functions should not be imported" { @@ -1333,7 +1333,7 @@ try try { $job = Get-Variable -Name PID -AsJob - $job | Should -Not -Be NullOrEmpty + $job | Should -Not -BeNullOrEmpty ($job -is [System.Management.Automation.Job]) | Should -BeTrue ($job.Finished.WaitOne([TimeSpan]::FromSeconds(10), $false)) | Should -BeTrue $job.JobStateInfo.State | Should -Be 'Completed' @@ -1647,7 +1647,7 @@ try try { Invoke-Command $session { function attack(${foo="$(calc)"}){echo "It is done."}} $module = Import-PSSession -Session $session -CommandName attack -ErrorAction SilentlyContinue -ErrorVariable expectedError -AllowClobber - $expectedError | Should -Not -Be NullOrEmpty + $expectedError | Should -Not -BeNullOrEmpty } finally { if ($null -ne $module) { Remove-Module $module -Force -ErrorAction SilentlyContinue } } @@ -1659,7 +1659,7 @@ try Invoke-Command $session { function Get-Command { write-error blah } } $module = Import-PSSession -Session $session -ErrorAction SilentlyContinue -ErrorVariable expectedError -AllowClobber - $expectedError | Should -Not -Be NullOrEmpty + $expectedError | Should -Not -BeNullOrEmpty $msg = [string]($expectedError[0]) $msg.Contains("blah") | Should -BeTrue @@ -1675,7 +1675,7 @@ try Invoke-Command $session { function notRequested { "notRequested" }; function Get-Command { Microsoft.PowerShell.Core\Get-Command Get-Variable,notRequested } } $module = Import-PSSession -Session $session Get-Variable -AllowClobber -ErrorAction SilentlyContinue -ErrorVariable expectedError - $expectedError | Should -Not -Be NullOrEmpty + $expectedError | Should -Not -BeNullOrEmpty $msg = [string]($expectedError[0]) $msg.Contains("notRequested") | Should -BeTrue @@ -1996,7 +1996,7 @@ try It "Select -First should work with implicit remoting" { $bar = foo | Select-Object -First 2 - $bar | Should -Not -Be NullOrEmpty + $bar | Should -Not -BeNullOrEmpty $bar.Count | Should -Be 2 $bar[0] | Should -BeExactly "a" $bar[1] | Should -BeExactly "b"