3f99de5784
* Added tests to close code coverage in CIM area Added CimAdapter.Tests for adaptation layer (code cribbed from BVT tests) Added SessionOption.Tests.ps1 (Code cribbed from BVT tests) Modified CimClass tests by adding more tests Added CimSession.Tests for basic tests of New-CimSession cmdlet Added CimInstance.Tests for basic tests of Get-CimInstance * Add CI tags to tests * unify test execution to use try/catch for marking tests as skipped moved test which retrieves cimclass via method to feature as it is not a common operation, this test can take some time as well
44 lines
1.6 KiB
PowerShell
44 lines
1.6 KiB
PowerShell
try {
|
|
# Get-CimClass works only on windows right now
|
|
if ( ! $IsWindows ) {
|
|
$PSDefaultParameterValues['it:pending'] = $true
|
|
}
|
|
|
|
Describe 'Get-CimClass' -tags "CI" {
|
|
It 'can get CIM_Error CIM class' {
|
|
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
|
|
}
|
|
|
|
It 'produces an error when a non-existent class is used' {
|
|
try {
|
|
Get-CimClass -ClassName thisclasstypedoesnotexist -ea stop
|
|
throw "Expected error did not occur"
|
|
}
|
|
catch {
|
|
$_.FullyQualifiedErrorId | should be "HRESULT 0x80041002,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand"
|
|
}
|
|
}
|
|
It 'produces an error when an improper namespace is used' {
|
|
try {
|
|
Get-CimClass -ClassName CIM_OperatingSystem -Namespace badnamespace -ea stop
|
|
throw "Expected error did not occur"
|
|
}
|
|
catch {
|
|
$_.FullyQualifiedErrorId | should be "HRESULT 0x8004100e,Microsoft.Management.Infrastructure.CimCmdlets.GetCimClassCommand"
|
|
}
|
|
}
|
|
}
|
|
|
|
# feature tests
|
|
Describe 'Get-CimClass' -tags @("Feature") {
|
|
It 'can retrieve a class when a method is provided' {
|
|
Get-CimClass -MethodName Reboot | Should Not BeNullOrEmpty
|
|
}
|
|
}
|
|
}
|
|
finally {
|
|
$PSDefaultParameterValues.Remove('it:pending')
|
|
}
|