From 22ca6dbb4a4ed9ffbdf9714fec249c0e4f841a93 Mon Sep 17 00:00:00 2001 From: Christoph Hannappel <37103421+ChristophHannappel@users.noreply.github.com> Date: Tue, 10 Mar 2026 20:13:18 +0100 Subject: [PATCH 1/2] Adds: Test for ResourceIds --- tests/Unit/DSCResources/DscResources.Tests.ps1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/Unit/DSCResources/DscResources.Tests.ps1 b/tests/Unit/DSCResources/DscResources.Tests.ps1 index 9c0c683..cc4f4ba 100644 --- a/tests/Unit/DSCResources/DscResources.Tests.ps1 +++ b/tests/Unit/DSCResources/DscResources.Tests.ps1 @@ -222,6 +222,19 @@ 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) From 49151d29cc012b0349857bc2d9db87510f90a5a6 Mon Sep 17 00:00:00 2001 From: Christoph Hannappel <37103421+ChristophHannappel@users.noreply.github.com> Date: Tue, 10 Mar 2026 20:15:30 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30a843a..7de5e1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Added a Test + Checks if the ResourceId ends with the []