mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Unify pester test syntax for the arguments of -BeOfType (#11558)
This commit is contained in:
@@ -78,9 +78,9 @@ Describe "Tests for (error, warning, etc) action preference" -Tags "CI" {
|
||||
|
||||
It '$err.Count' { $err.Count | Should -Be 1 }
|
||||
It '$err[0] should not be $null' { $err[0] | Should -Not -BeNullOrEmpty }
|
||||
It '$err[0].GetType().Name' { $err[0] | Should -BeOfType "System.Management.Automation.ActionPreferenceStopException" }
|
||||
It '$err[0].GetType().Name' { $err[0] | Should -BeOfType System.Management.Automation.ActionPreferenceStopException }
|
||||
It '$err[0].ErrorRecord' { $err[0].ErrorRecord | Should -Not -BeNullOrEmpty }
|
||||
It '$err[0].ErrorRecord.Exception.GetType().Name' { $err[0].ErrorRecord.Exception | Should -BeOfType "System.Management.Automation.ItemNotFoundException" }
|
||||
It '$err[0].ErrorRecord.Exception.GetType().Name' { $err[0].ErrorRecord.Exception | Should -BeOfType System.Management.Automation.ItemNotFoundException }
|
||||
}
|
||||
|
||||
It 'Action preference of Ignore can be set as a preference variable using a string value' {
|
||||
|
||||
@@ -43,7 +43,7 @@ Describe "Tests for hashtable to PSCustomObject conversion" -Tags "CI" {
|
||||
It 'Hashtable conversion to PSCustomObject retains insertion order of hashtable keys when passed a hashliteral' {
|
||||
|
||||
$x = [pscustomobject]@{one=1;two=2}
|
||||
$x | Should -BeOfType "System.Management.automation.psobject"
|
||||
$x | Should -BeOfType System.Management.automation.psobject
|
||||
|
||||
$p = 0
|
||||
# Checks if the first property is One
|
||||
@@ -60,7 +60,7 @@ Describe "Tests for hashtable to PSCustomObject conversion" -Tags "CI" {
|
||||
It 'Conversion of Ordered hashtable to PSCustomObject should succeed' {
|
||||
|
||||
$x = [pscustomobject][ordered]@{one=1;two=2}
|
||||
$x | Should -BeOfType "System.Management.automation.psobject"
|
||||
$x | Should -BeOfType System.Management.automation.psobject
|
||||
|
||||
$p = 0
|
||||
# Checks if the first property is One
|
||||
|
||||
@@ -54,7 +54,7 @@ Describe 'Testing of script internationalization' -Tags "CI" {
|
||||
import-localizedData mydata -uiculture nl-NL -ErrorAction SilentlyContinue -ErrorVariable ev
|
||||
|
||||
$ev | Should -Not -BeNullOrEmpty
|
||||
$ev[0].Exception | Should -BeOfType "System.Management.Automation.PSInvalidOperationException"
|
||||
$ev[0].Exception | Should -BeOfType System.Management.Automation.PSInvalidOperationException
|
||||
}
|
||||
|
||||
It 'Import different file name is done correctly' {
|
||||
|
||||
@@ -28,11 +28,11 @@ Describe "Native streams behavior with PowerShell" -Tags 'CI' {
|
||||
It 'uses ErrorRecord object to return stderr output' {
|
||||
($out | Measure-Object).Count | Should -BeGreaterThan 1
|
||||
|
||||
$out[0] | Should -BeOfType 'System.Management.Automation.ErrorRecord'
|
||||
$out[0] | Should -BeOfType System.Management.Automation.ErrorRecord
|
||||
$out[0].FullyQualifiedErrorId | Should -Be 'NativeCommandError'
|
||||
|
||||
$out | Select-Object -Skip 1 | ForEach-Object {
|
||||
$_ | Should -BeOfType 'System.Management.Automation.ErrorRecord'
|
||||
$_ | Should -BeOfType System.Management.Automation.ErrorRecord
|
||||
$_.FullyQualifiedErrorId | Should -Be 'NativeCommandErrorMessage'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ Describe "Update both OutVariable and ErrorVariable" -Tags "CI" {
|
||||
It '$get_item_err.count and $get_item_err[0].exception' {
|
||||
$get_item_err.count | Should -Be 1
|
||||
$get_item_err[0].exception | Should -Not -BeNullOrEmpty
|
||||
$get_item_err[0].exception | Should -BeOftype 'System.Management.Automation.ItemNotFoundException'
|
||||
$get_item_err[0].exception | Should -BeOfType System.Management.Automation.ItemNotFoundException
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user