diff --git a/CHANGELOG.md b/CHANGELOG.md index fb1b98b..ee1a4e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Test the compiled Mof File if the RessourceID ends with the ResourceName + ### Fixed - DscTagging: Added parameter 'BuildNumber'. diff --git a/tests/Unit/DSCResources/DscResources.Tests.ps1 b/tests/Unit/DSCResources/DscResources.Tests.ps1 index c74414d..5f84b42 100644 --- a/tests/Unit/DSCResources/DscResources.Tests.ps1 +++ b/tests/Unit/DSCResources/DscResources.Tests.ps1 @@ -104,6 +104,20 @@ configuration "Config_$dscResourceName" { $mofFile | Should -BeOfType System.IO.FileInfo } + It "'' has ResourceIDs ending with []" -TestCases $testCases { + if ($Skip) + { + Set-ItResult -Skipped -Because "Tests for '$dscResourceName' are skipped" + } + $mofContent = Get-Content -Raw -Path "$($OutputDirectory)\localhost_$dscResourceName.mof" + $selectString = Select-String -InputObject $mofContent -Pattern 'ResourceID = ".+' -AllMatches + foreach ($value in $selectString.Matches | Select-Object -ExpandProperty Value) + { + $value | Should -Match -RegularExpression "(ResourceID = `".*)(:{2}\[$dscResourceName\]$dscResourceName`";)" + } + } + + AfterAll { Remove-Item -Path C:\Temp\JeaRoleTest.ps1 if (-not $tempExists)