PowerShellOrg/DSC — pull request #42 by dlwyatt (2014-07-26 03:06:50+00:00)
Title: Test-cDscResource fix for Embedded Instances

DSC Resources which contain properties that are embedded instances can now be tested by cDscResource without generating errors due to mismatched type names.

This could have been approached by adding a new entry to the $TypeMap hashtable for CimInstance and CimInstance[] , but other parts of the module also use $TypeMap, and I wasn't sure if that would create some new bug.

Instead, I added a flag to the DscResourceProperty class which indicates whether it's an "EmbeddedInstance" property, and ignored the type mismatch test when this flag is set. This way the change is localized to fixing the one bug, and shouldn't have any other undesirable effects.

Because of this change, the old $ValidEmbeddedResource array and $AdditionalInvalidEmbeddedResource parameter are no longer necessary, and have been removed from the code. (This is a breaking change for any current unit tests which try to pass in a value for -AdditionalInvalidEmbeddedResource).

MSFT_KeyValuePair and MSFT_Credential still have some hard-coded special treatment, because they map to properties of type hashtable and PSCredential. All other EmbeddedInstance types are assumed to be of type CimInstance or CimInstance[] in the psm1 file, at this point.