You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/powershell/Modules/Microsoft.PowerShell.Management/Get-ComputerInfo.Tests.ps1
+39-3Lines changed: 39 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,23 @@ function Get-ComputerInfoForTest
23
23
}
24
24
}
25
25
26
+
functionGet-StringValuesFromValueMap
27
+
{
28
+
param([string[]] $values, [hashtable] $valuemap)
29
+
30
+
[string] $stringValues= [string]::Empty
31
+
32
+
foreach ($valuein$values)
33
+
{
34
+
if ($stringValues-ne [string]::Empty)
35
+
{
36
+
$stringValues+=","
37
+
}
38
+
$stringValues+=$valuemap[$value]
39
+
}
40
+
$stringValues
41
+
}
42
+
26
43
functionGet-PropertyNamesForComputerInfoTest
27
44
{
28
45
$propertyNames=@()
@@ -1346,11 +1363,30 @@ try {
1346
1363
else
1347
1364
{
1348
1365
$deviceGuard=Get-DeviceGuard
1349
-
$observed.DeviceGuardSmartStatus| Should Be $deviceGuard.SmartStatus
1350
-
$observed.DeviceGuardRequiredSecurityProperties| Should Be $deviceGuard.RequiredSecurityProperties
1366
+
# can't get amended qualifiers using cim cmdlets so we define them here
1367
+
$requiredSecurityPropertiesValues=@{
1368
+
"1"="BaseVirtualizationSupport"
1369
+
"2"="SecureBoot"
1370
+
"3"="DMAProtection"
1371
+
"4"="SecureMemoryOverwrite"
1372
+
"5"="UEFICodeReadonly"
1373
+
"6"="SMMSecurityMitigations1.0"
1374
+
}
1375
+
$smartStatusValues=@{
1376
+
"0"="Off"
1377
+
"1"="Enabled"
1378
+
"2"="Running"
1379
+
}
1380
+
$securityServicesRunningValues=@{
1381
+
"0"="0"
1382
+
"1"="CredentialGuard"
1383
+
"2"="HypervisorEnforcedCodeIntegrity"
1384
+
}
1385
+
$observed.DeviceGuardSmartStatus| Should Be (Get-StringValuesFromValueMap-valuemap $smartStatusValues-values $deviceGuard.SmartStatus)
1386
+
[string]::Join(",",$observed.DeviceGuardRequiredSecurityProperties) | Should Be (Get-StringValuesFromValueMap-valuemap $requiredSecurityPropertiesValues-values $deviceGuard.RequiredSecurityProperties)
1351
1387
$observed.DeviceGuardAvailableSecurityProperties| Should Be $deviceGuard.AvailableSecurityProperties
1352
1388
$observed.DeviceGuardSecurityServicesConfigured| Should Be $deviceGuard.SecurityServicesConfigured
1353
-
$observed.DeviceGuardSecurityServicesRunning| Should Be $deviceGuard.SecurityServicesRunning
1389
+
[string]::Join(",",$observed.DeviceGuardSecurityServicesRunning)| Should Be (Get-StringValuesFromValueMap-valuemap $securityServicesRunningValues-values $deviceGuard.SecurityServicesRunning)
1354
1390
$observed.DeviceGuardCodeIntegrityPolicyEnforcementStatus| Should Be $deviceGuard.CodeIntegrityPolicyEnforcementStatus
1355
1391
$observed.DeviceGuardUserModeCodeIntegrityPolicyEnforcementStatus| Should Be $deviceGuard.UserModeCodeIntegrityPolicyEnforcementStatus
0 commit comments