diff --git a/test/powershell/Modules/CimCmdlets/CimInstance.Tests.ps1 b/test/powershell/Modules/CimCmdlets/CimInstance.Tests.ps1 index 8fc59e40a62..c4960a2b463 100644 --- a/test/powershell/Modules/CimCmdlets/CimInstance.Tests.ps1 +++ b/test/powershell/Modules/CimCmdlets/CimInstance.Tests.ps1 @@ -13,7 +13,7 @@ Try { # we can't use equals here as on windows cimclassname # is win32_computersystem, but that's not likely to be the # case on non-Windows systems - $instance.cimClass.CimClassName | should match _computersystem + $instance.cimClass.CimClassName | Should -Match _computersystem } It "Property access should be case insensitive" { foreach($property in $instance.psobject.properties.name) { @@ -21,11 +21,11 @@ Try { $pLower = $property.ToLower() [string]$pLowerValue = $pinstance.$pLower -join "," [string]$pUpperValue = $pinstance.$pUpper -join "," - $pLowerValue | should be $pUpperValue + $pLowerValue | Should -BeExactly $pUpperValue } } It "GetCimSessionInstanceId method invocation should return data" { - $instance.GetCimSessionInstanceId() | Should BeOfType "Guid" + $instance.GetCimSessionInstanceId() | Should -BeOfType "Guid" } It "should produce an error for a non-existing classname" { try { @@ -33,7 +33,7 @@ Try { throw "expected error did not occur" } catch { - $_.FullyQualifiedErrorId | should be "HRESULT 0x80041010,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand" + $_.FullyQualifiedErrorId | Should -Be "HRESULT 0x80041010,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand" } } } diff --git a/test/powershell/Modules/CimCmdlets/CimSession.Tests.ps1 b/test/powershell/Modules/CimCmdlets/CimSession.Tests.ps1 index e1096648561..b54be2e2135 100644 --- a/test/powershell/Modules/CimCmdlets/CimSession.Tests.ps1 +++ b/test/powershell/Modules/CimCmdlets/CimSession.Tests.ps1 @@ -20,24 +20,24 @@ try { $sessionName = [guid]::NewGuid() $session = New-CimSession -ComputerName . -name $sessionName $sessions += $session - $session.Name | Should be $sessionName - $session.InstanceId | should BeOfType "System.Guid" + $session.Name | Should -Be $sessionName + $session.InstanceId | Should -BeOfType "System.Guid" } It "A Cim session can be retrieved" { $sessionName = [guid]::NewGuid() $session = New-CimSession -ComputerName . -name $sessionName $sessions += $session - (get-cimsession -Name $sessionName).InstanceId | should be $session.InstanceId - (get-cimsession -Id $session.Id).InstanceId | should be $session.InstanceId - (get-cimsession -InstanceId $session.InstanceId).InstanceId | should be $session.InstanceId + (get-cimsession -Name $sessionName).InstanceId | Should -Be $session.InstanceId + (get-cimsession -Id $session.Id).InstanceId | Should -Be $session.InstanceId + (get-cimsession -InstanceId $session.InstanceId).InstanceId | Should -Be $session.InstanceId } It "A cim session can be removed" { $sessionName = [guid]::NewGuid() $session = New-CimSession -ComputerName . -name $sessionName $sessions += $session - $session.Name | Should be $sessionName + $session.Name | Should -Be $sessionName $session | Remove-CimSession - Get-CimSession $session.Id -ErrorAction SilentlyContinue | should BeNullOrEmpty + Get-CimSession $session.Id -ErrorAction SilentlyContinue | Should -BeNullOrEmpty } } } diff --git a/test/powershell/Modules/CimCmdlets/Get-CimClass.Tests.ps1 b/test/powershell/Modules/CimCmdlets/Get-CimClass.Tests.ps1 index b104ec8268d..203feaea9cb 100644 --- a/test/powershell/Modules/CimCmdlets/Get-CimClass.Tests.ps1 +++ b/test/powershell/Modules/CimCmdlets/Get-CimClass.Tests.ps1 @@ -8,10 +8,10 @@ try { Describe 'Get-CimClass' -tags "CI" { It 'can get CIM_Error CIM class' { - Get-CimClass -ClassName CIM_Error | Should Not BeNullOrEmpty + Get-CimClass -ClassName CIM_Error | Should -Not -BeNullOrEmpty } It 'can get class when namespace is specified' { - Get-CimClass -ClassName CIM_OperatingSystem -Namespace root/cimv2 | Should Not BeNullOrEmpty + Get-CimClass -ClassName CIM_OperatingSystem -Namespace root/cimv2 | Should -Not -BeNullOrEmpty } It 'produces an error when a non-existent class is used' { @@ -20,7 +20,7 @@ try { throw "Expected error did not occur" } catch { - $_.FullyQualifiedErrorId | should be "HRESULT 0x80041002,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand" + $_.FullyQualifiedErrorId | Should -Be "HRESULT 0x80041002,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand" } } It 'produces an error when an improper namespace is used' { @@ -29,7 +29,7 @@ try { throw "Expected error did not occur" } catch { - $_.FullyQualifiedErrorId | should be "HRESULT 0x8004100e,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand" + $_.FullyQualifiedErrorId | Should -Be "HRESULT 0x8004100e,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand" } } } @@ -37,7 +37,7 @@ try { # feature tests Describe 'Get-CimClass' -tags @("Feature") { It 'can retrieve a class when a method is provided' { - Get-CimClass -MethodName Reboot | Should Not BeNullOrEmpty + Get-CimClass -MethodName Reboot | Should -Not -BeNullOrEmpty } } }