@@ -42,7 +42,7 @@ class ResourceBase
4242 if (-not [System.String ]::IsNullOrEmpty($BasePath ))
4343 {
4444 <#
45- Passing the base directory of the module that contain the
45+ Passing the base directory of the module that contains the
4646 derived class.
4747 #>
4848 $getLocalizedDataRecursiveParameters.BaseDirectory = $BasePath
@@ -74,7 +74,7 @@ class ResourceBase
7474 # Set values returned from the derived class' GetCurrentState().
7575 foreach ($propertyName in $this.PSObject.Properties.Name )
7676 {
77- if ($propertyName -in @ ($getCurrentStateResult.Keys ))
77+ if ($propertyName -in @ ($getCurrentStateResult.Keys ) -and $null -ne $getCurrentStateResult . $propertyName )
7878 {
7979 $dscResourceObject .$propertyName = $getCurrentStateResult .$propertyName
8080 }
@@ -114,7 +114,7 @@ class ResourceBase
114114 }
115115
116116 <#
117- Returns all enforced properties not in desires state, or $null if
117+ Returns all enforced properties not in desired state, or $null if
118118 all enforced properties are in desired state.
119119 #>
120120 $propertiesNotInDesiredState = $this.Compare ($getCurrentStateResult , @ ())
@@ -137,15 +137,11 @@ class ResourceBase
137137
138138 [void ] Set()
139139 {
140- $this.Normalize ()
141-
142140 # Get all key properties.
143141 $keyProperty = $this | Get-DscProperty - Attribute ' Key'
144142
145143 Write-Verbose - Message ($this.localizedData.SetDesiredState -f $this.GetType ().Name, ($keyProperty | ConvertTo-Json - Compress))
146144
147- $this.Assert ()
148-
149145 <#
150146 Returns all enforced properties not in desires state, or $null if
151147 all enforced properties are in desired state.
@@ -163,7 +159,7 @@ class ResourceBase
163159
164160 <#
165161 Call the Modify() method with the properties that should be enforced
166- and was not in desired state.
162+ and are not in desired state.
167163 #>
168164 $this.Modify ($propertiesToModify )
169165 }
@@ -175,38 +171,26 @@ class ResourceBase
175171
176172 [System.Boolean ] Test()
177173 {
178- $this.Normalize ()
179-
180174 # Get all key properties.
181175 $keyProperty = $this | Get-DscProperty - Attribute ' Key'
182176
183177 Write-Verbose - Message ($this.localizedData.TestDesiredState -f $this.GetType ().Name, ($keyProperty | ConvertTo-Json - Compress))
184178
185- $this.Assert ()
186-
187- $isInDesiredState = $true
188-
189179 <#
190- Returns all enforced properties not in desires state, or $null if
180+ Returns all enforced properties not in desired state, or $null if
191181 all enforced properties are in desired state.
182+ Will call Get().
192183 #>
193184 $propertiesNotInDesiredState = $this.Compare ()
194185
195186 if ($propertiesNotInDesiredState )
196- {
197- $isInDesiredState = $false
198- }
199-
200- if ($isInDesiredState )
201- {
202- Write-Verbose - Message $this.localizedData.InDesiredState
203- }
204- else
205187 {
206188 Write-Verbose - Message $this.localizedData.NotInDesiredState
189+ return $false
207190 }
208191
209- return $isInDesiredState
192+ Write-Verbose - Message $this.localizedData.InDesiredState
193+ return $true
210194 }
211195
212196 <#
@@ -246,7 +230,7 @@ class ResourceBase
246230 }
247231
248232 <#
249- Returns all enforced properties not in desires state, or $null if
233+ Returns all enforced properties not in desired state, or $null if
250234 all enforced properties are in desired state.
251235 #>
252236 return (Compare-DscParameterState @CompareDscParameterState )
@@ -289,7 +273,7 @@ class ResourceBase
289273
290274 <#
291275 This method can be overridden if resource specific property asserts are
292- needed. The parameter properties will contain the properties that was
276+ needed. The parameter properties will contain the properties that are
293277 assigned a value.
294278 #>
295279 [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (' AvoidEmptyNamedBlocks' , ' ' )]
@@ -299,7 +283,7 @@ class ResourceBase
299283
300284 <#
301285 This method can be overridden if resource specific property normalization
302- is needed. The parameter properties will contain the properties that was
286+ is needed. The parameter properties will contain the properties that are
303287 assigned a value.
304288 #>
305289 [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute (' AvoidEmptyNamedBlocks' , ' ' )]
0 commit comments