@@ -53,17 +53,16 @@ Describe 'WMI adapter resource tests' {
53
53
$r | Should -Not - BeNullOrEmpty
54
54
$res = $r | ConvertFrom-Json
55
55
56
- Write-Verbose ($res.results [1 ].result.actualState.result[4 ] | ConvertTo-Json - Depth 10 ) - Verbose
57
56
$res.results [1 ].result.actualState.result[0 ].properties.Name | Should -Not - BeNullOrEmpty
58
57
$res.results [1 ].result.actualState.result[0 ].properties.BootupState | Should - BeNullOrEmpty
59
58
$res.results [1 ].result.actualState.result[1 ].properties.Caption | Should -Not - BeNullOrEmpty
60
59
$res.results [1 ].result.actualState.result[1 ].properties.BuildNumber | Should - BeNullOrEmpty
61
- $res.results [1 ].result.actualState.result[4 ].properties.AdapterType | Should - BeLike " Ethernet* "
60
+ $res.results [1 ].result.actualState.result[4 ].properties.Name | Should -Not - BeNullOrEmpty
62
61
}
63
62
64
63
It ' Set does not work without input for resource' - Skip:(! $IsWindows ) {
65
- $s = dsc resource set -- resource root.cimv2/ Win32_Environment -- input ' {}' 2>&1
66
- $s | Should - BeLike " *No valid properties found in the CIM class 'Win32_Environment' for the provided properties.*"
64
+ $out = dsc resource set -- resource root.cimv2/ Win32_Environment -- input ' {}' 2>&1
65
+ $out [ 0 ] | Should - BeLike " *No valid properties found in the CIM class 'Win32_Environment' for the provided properties.*"
67
66
}
68
67
69
68
It ' Set does not work without a key property' - Skip:(! $IsWindows ) {
@@ -72,8 +71,8 @@ Describe 'WMI adapter resource tests' {
72
71
UserName = (" {0}\{1}" -f $env: USERDOMAIN , $env: USERNAME ) # Read-only property is key, but we require a key property to be set
73
72
} | ConvertTo-Json
74
73
75
- $s = dsc resource set - r root.cimv2/ Win32_Environment - i $i 2>&1
76
- $s | Should - BeLike " *All key properties in the CIM class 'Win32_Environment' are read-only, which is not supported.*"
74
+ $out = dsc resource set - r root.cimv2/ Win32_Environment - i $i 2>&1
75
+ $out [ 0 ] | Should - BeLike " *All key properties in the CIM class 'Win32_Environment' are read-only, which is not supported.*"
77
76
}
78
77
79
78
It ' Set works on a WMI resource' - Skip:(! $IsWindows ) {
@@ -86,10 +85,10 @@ Describe 'WMI adapter resource tests' {
86
85
$r = dsc resource set - r root.cimv2/ Win32_Environment - i $i
87
86
$LASTEXITCODE | Should - Be 0
88
87
89
- $out = $r | ConvertFrom-Json
90
- $out .afterState.Name | Should - Be ' test'
91
- $out .afterState.VariableValue | Should - Be ' test'
92
- $out .afterState.UserName | Should - Be (" {0}\{1}" -f $env: USERDOMAIN , $env: USERNAME )
88
+ $res = $r | ConvertFrom-Json
89
+ $res .afterState.Name | Should - Be ' test'
90
+ $res .afterState.VariableValue | Should - Be ' test'
91
+ $res .afterState.UserName | Should - Be (" {0}\{1}" -f $env: USERDOMAIN , $env: USERNAME )
93
92
}
94
93
95
94
It ' Update works on a WMI resource' - Skip:(! $IsWindows ) {
@@ -102,9 +101,9 @@ Describe 'WMI adapter resource tests' {
102
101
$r = dsc resource set - r root.cimv2/ Win32_Environment - i $i
103
102
$LASTEXITCODE | Should - Be 0
104
103
105
- $out = $r | ConvertFrom-Json
106
- $out .afterState.Name | Should - Be ' test'
107
- $out .afterState.VariableValue | Should - Be ' update'
108
- $out .afterState.UserName | Should - Be (" {0}\{1}" -f $env: USERDOMAIN , $env: USERNAME )
104
+ $res = $r | ConvertFrom-Json
105
+ $res .afterState.Name | Should - Be ' test'
106
+ $res .afterState.VariableValue | Should - Be ' update'
107
+ $res .afterState.UserName | Should - Be (" {0}\{1}" -f $env: USERDOMAIN , $env: USERNAME )
109
108
}
110
109
}
0 commit comments