diff --git a/test/powershell/Language/Scripting/Indexer.Tests.ps1 b/test/powershell/Language/Scripting/Indexer.Tests.ps1 index bfc6656bb..378f2b3ce 100644 --- a/test/powershell/Language/Scripting/Indexer.Tests.ps1 +++ b/test/powershell/Language/Scripting/Indexer.Tests.ps1 @@ -12,17 +12,17 @@ Describe 'Tests for indexers' -Tags "CI" { $hashtable["Hello There"] | Should -BeNullOrEmpty } - It 'Wmi object implements an indexer' -Skip:$IsCoreCLR { + It 'CimClass implements an indexer' -Skip:(-not $IsWindows) { - $service = Get-WmiObject -List -Amended Win32_Service + $service = Get-CimClass -ClassName Win32_Service - $service.Properties["DisplayName"].Name | Should -BeExactly 'DisplayName' + $service.CimClassProperties["DisplayName"].Name | Should -BeExactly 'DisplayName' } - It 'Accessing a Indexed property of a wmi object that does not exist should return $NULL' -skip:$IsCoreCLR { + It 'Accessing a Indexed property of a CimClass that does not exist should return $NULL' -Skip:(-not $IsWindows) { - $service = Get-WmiObject -List -Amended Win32_Service - $service.Properties["Hello There"] | Should -BeNullOrEmpty + $service = Get-CimClass -ClassName Win32_Service + $service.CimClassProperties["Hello There"] | Should -BeNullOrEmpty } It 'ITuple implementations can be indexed' { diff --git a/test/powershell/Language/Scripting/OrderedAttributeForHashTables.Tests.ps1 b/test/powershell/Language/Scripting/OrderedAttributeForHashTables.Tests.ps1 index 3beeebb84..2115cede0 100644 --- a/test/powershell/Language/Scripting/OrderedAttributeForHashTables.Tests.ps1 +++ b/test/powershell/Language/Scripting/OrderedAttributeForHashTables.Tests.ps1 @@ -1,17 +1,6 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. Describe 'Test for cmdlet to support Ordered Attribute on hash literal nodes' -Tags "CI" { - BeforeAll { - If (-not $IsCoreCLR) { - Get-WmiObject -Query "select * from win32_environment where name='TestWmiInstance'" | Remove-WmiObject - } - } - AfterAll { - If (-not $IsCoreCLR) { - Get-WmiObject -Query "select * from win32_environment where name='TestWmiInstance'" | Remove-WmiObject - } - } - It 'New-Object - Property Parameter Must take IDictionary' { $a = new-object psobject -property ([ordered]@{one=1;two=2}) $a | Should -Not -BeNullOrEmpty @@ -45,15 +34,30 @@ Describe 'Test for cmdlet to support Ordered Attribute on hash literal nodes' -T It '$a should not be $null' { $script:a | Should -Not -BeNullOrEmpty } } - It 'Set-WmiInstance cmdlet - Argument parameter must take IDictionary' -skip:$IsCoreCLR { + Context 'New-CimInstance cmdlet' { + BeforeAll { + If ($IsWindows) { + Get-CimInstance -ClassName Win32_Environment -Filter "name='TestCimInstance'" | Remove-CimInstance + } + } + AfterAll { + If ($IsWindows) { + Get-CimInstance -ClassName Win32_Environment -Filter "name='TestCimInstance'" | Remove-CimInstance + } + } - $script:a = $null + It 'Property parameter must take IDictionary' -Skip:(-not $IsWindows) { - { $script:a = set-wmiinstance -class win32_environment -argument ([ordered]@{Name="TestWmiInstance"; - VariableValue="testvalu234e"; - UserName=""}) } | Should -Not -Throw - $script:a | Should -Not -BeNullOrEmpty - $script:a.Name | Should -BeExactly "TestWmiInstance" + $script:a = $null + + { $script:a = New-CimInstance -ClassName Win32_Environment -Property ([ordered]@{ + Name="TestCimInstance"; + VariableValue="testvalu234e"; + UserName=[System.Environment]::UserName + }) -ClientOnly } | Should -Not -Throw + $script:a | Should -Not -BeNullOrEmpty + $script:a.Name | Should -BeExactly "TestCimInstance" + } } Context 'Select-Object cmdlet - Property parameter (Calculated properties) must take IDictionary' {