Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
Get-CimClass.Tests.ps136 linesDownload Raw Back to CimCmdlets
1# Copyright (c) Microsoft Corporation.2# Licensed under the MIT License.3 4Describe 'Get-CimClass' -Tags "CI" {5 6    It 'can get CIM_Error CIM class' -Pending:(-not $IsWindows) {7        Get-CimClass -ClassName CIM_Error | Should -Not -BeNullOrEmpty8    }9 10    It 'can get class when namespace is specified' -Pending:(-not $IsWindows) {11        Get-CimClass -ClassName CIM_OperatingSystem -Namespace root/cimv2 | Should -Not -BeNullOrEmpty12    }13 14    It 'produces an error when a non-existent class is used' -Pending:(-not $IsWindows) {15        { Get-CimClass -ClassName thisclasstypedoesnotexist -ErrorAction stop } |16            Should -Throw -ErrorId "HRESULT 0x80041002,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand"17    }18 19    It 'produces an error when an improper namespace is used' -Pending:(-not $IsWindows) {20        { Get-CimClass -ClassName CIM_OperatingSystem -Namespace badnamespace -ErrorAction stop } |21            Should -Throw -ErrorId "HRESULT 0x8004100e,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand"22    }23}24 25# feature tests26Describe 'Get-CimClass' -Tags @("Feature") {27    It 'can retrieve a class when a method is provided' -Pending:(-not $IsWindows) {28        Get-CimClass -MethodName Reboot | Should -Not -BeNullOrEmpty29    }30 31    It 'can retrieve class amended qualifiers' -Pending:(-not $IsWindows) {32        $a = Get-CimClass -Class 'Win32_LogicalDisk' -Amended33        $a.CimClassProperties['DriveType'].Qualifiers.Item('Values').Value.Count | Should -Be 734    }35}36