- 
                Notifications
    You must be signed in to change notification settings 
- Fork 46
Migrate Tests to Pester 5 #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| WalkthroughReworks module loading/localization, migrates tests to Pester 5 and PowerShell Core, updates CI/build/tooling and analyzer settings, introduces a common submodule with OS helpers, changes many DSC resource parameter types to explicit System.* types, replaces legacy test suites with new Pester v5 suites, and adjusts error/validation flows. Changes
 Sequence Diagram(s)sequenceDiagram
  autonumber
  actor User
  participant DSC as DSC Engine
  participant Res as Resource (.psm1)
  participant Common as xRemoteDesktopSessionHost.Common
  participant RD as RemoteDesktop Module
  User->>DSC: Invoke Get/Test/Set-TargetResource
  DSC->>Res: Call *-TargetResource(params)
  Res->>Res: Run early checks (OS, param validation)
  Res->>Common: Import computed common modules (modulePath)
  Res->>RD: Assert-Module 'RemoteDesktop' -ImportModule
  alt Assert succeeds
    Res->>RD: Call RD cmdlets (Get-/Set-/Add-/Remove-RD*)
    RD-->>Res: Return results
    Res-->>DSC: Return hashtable / boolean
  else Assert fails
    Res-->>DSC: Throw missing-module error
  end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Potential review hotspots: 
 Possibly related PRs
 Pre-merge checks❌ Failed checks (1 warning)
 ✅ Passed checks (4 passed)
 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
 🚧 Files skipped from review as they are similar to previous changes (1)
 🧰 Additional context used📓 Path-based instructions (3)**⚙️ CodeRabbit configuration file 
 Files: 
 {**/*.ps1,**/*.psm1,**/*.psd1}⚙️ CodeRabbit configuration file 
 Files: 
 source/**/*.ps1⚙️ CodeRabbit configuration file 
 Files: 
 🧠 Learnings (11)📓 Common learnings📚 Learning: 2025-10-26T13:28:23.439ZApplied to files: 
 📚 Learning: 2025-09-12T13:20:14.850ZApplied to files: 
 📚 Learning: 2025-10-26T13:28:23.439ZApplied to files: 
 📚 Learning: 2025-08-16T13:15:17.108ZApplied to files: 
 📚 Learning: 2025-10-26T13:28:23.439ZApplied to files: 
 📚 Learning: 2025-08-16T13:15:17.108ZApplied to files: 
 📚 Learning: 2025-10-26T13:28:23.439ZApplied to files: 
 📚 Learning: 2025-10-26T13:28:23.439ZApplied to files: 
 📚 Learning: 2025-10-26T13:28:23.439ZApplied to files: 
 📚 Learning: 2025-10-03T15:27:24.417ZApplied to files: 
 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 13
🧹 Nitpick comments (6)
source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1 (2)
1-5: Add localization import at module topImport localized strings for messages to comply with MOF resource guidelines.
As per coding guidelines
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common') +# Import localized strings +$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US' +
12-12: Ensure RemoteDesktop is imported deterministicallyUse -ImportModule for consistency with other resources and to avoid autoload reliance.
As per coding guidelines
-Assert-Module -ModuleName 'RemoteDesktop' +Assert-Module -ModuleName 'RemoteDesktop' -ImportModulesource/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1 (2)
1-5: Add localization import at module topLoad localized strings so verbose/error messages are not hardcoded.
As per coding guidelines
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common') +# Import localized strings +$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US' +
12-12: Align Assert-Module usage with other resourcesAdd -ImportModule to actually import RemoteDesktop and avoid relying on autoloading.
As per coding guidelines
-Assert-Module -ModuleName 'RemoteDesktop' +Assert-Module -ModuleName 'RemoteDesktop' -ImportModulesource/Modules/xRemoteDesktopSessionHost.Common/xRemoteDesktopSessionHost.Common.psd1 (1)
72-72: Empty FunctionsToExport may block public function exportsWith FunctionsToExport = @(), nothing is exported unless the psm1 calls Export-ModuleMember. Please confirm the psm1 explicitly exports Get-xRemoteDesktopSessionHostOsVersion and Test-xRemoteDesktopSessionHostOsRequirement, or list them here.
build.yaml (1)
76-92: Pester output encodingsConsider using utf8 for OutputEncoding/TestResult to align with UTF‑8 file encoding policy and avoid non‑ASCII truncation in logs.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (42)
- .vscode/settings.json(1 hunks)
- CHANGELOG.md(1 hunks)
- RequiredModules.psd1(2 hunks)
- azure-pipelines.yml(1 hunks)
- build.yaml(4 hunks)
- source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1(3 hunks)
- source/DSCResources/MSFT_xRDConnectionBrokerHAMode/MSFT_xRDConnectionBrokerHAMode.psm1(3 hunks)
- source/DSCResources/MSFT_xRDGatewayConfiguration/MSFT_xRDGatewayConfiguration.psm1(2 hunks)
- source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1(1 hunks)
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1(1 hunks)
- source/DSCResources/MSFT_xRDServer/MSFT_xRDServer.psm1(1 hunks)
- source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1(1 hunks)
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1(1 hunks)
- source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1(1 hunks)
- source/Modules/en-US/xRemoteDesktopSessionHostCommon.strings.psd1(0 hunks)
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Get-xRemoteDesktopSessionHostOsVersion.ps1(1 hunks)
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1(1 hunks)
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1(1 hunks)
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1(1 hunks)
- source/Modules/xRemoteDesktopSessionHost.Common/xRemoteDesktopSessionHost.Common.psd1(3 hunks)
- source/Modules/xRemoteDesktopSessionHostCommon.psm1(0 hunks)
- source/en-US/xRemoteDesktopSessionHost.strings.psd1(1 hunks)
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1(1 hunks)
- tests/Unit/MSFT_xRDCertificateConfiguration.tests.ps1(0 hunks)
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1(1 hunks)
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.tests.ps1(0 hunks)
- tests/Unit/MSFT_xRDGatewayConfiguration.Tests.ps1(1 hunks)
- tests/Unit/MSFT_xRDGatewayConfiguration.tests.ps1(0 hunks)
- tests/Unit/MSFT_xRDLicenseConfiguration.Tests.ps1(1 hunks)
- tests/Unit/MSFT_xRDLicenseConfiguration.tests.ps1(0 hunks)
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1(1 hunks)
- tests/Unit/MSFT_xRDRemoteApp.tests.ps1(0 hunks)
- tests/Unit/MSFT_xRDServer.Tests.ps1(1 hunks)
- tests/Unit/MSFT_xRDServer.tests.ps1(0 hunks)
- tests/Unit/MSFT_xRDSessionCollection.Tests.ps1(1 hunks)
- tests/Unit/MSFT_xRDSessionCollection.tests.ps1(0 hunks)
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1(1 hunks)
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.tests.ps1(0 hunks)
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1(1 hunks)
- tests/Unit/MSFT_xRDSessionDeployment.tests.ps1(0 hunks)
- tests/Unit/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.Tests.ps1(1 hunks)
- tests/Unit/xRemoteDesktopSessionHost.tests.ps1(0 hunks)
💤 Files with no reviewable changes (12)
- source/Modules/xRemoteDesktopSessionHostCommon.psm1
- tests/Unit/MSFT_xRDRemoteApp.tests.ps1
- tests/Unit/MSFT_xRDServer.tests.ps1
- tests/Unit/MSFT_xRDLicenseConfiguration.tests.ps1
- tests/Unit/MSFT_xRDSessionDeployment.tests.ps1
- tests/Unit/xRemoteDesktopSessionHost.tests.ps1
- tests/Unit/MSFT_xRDCertificateConfiguration.tests.ps1
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.tests.ps1
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.tests.ps1
- tests/Unit/MSFT_xRDSessionCollection.tests.ps1
- tests/Unit/MSFT_xRDGatewayConfiguration.tests.ps1
- source/Modules/en-US/xRemoteDesktopSessionHostCommon.strings.psd1
🧰 Additional context used
📓 Path-based instructions (8)
**
⚙️ CodeRabbit configuration file
**: # DSC Community GuidelinesTerminology
- Command: Public command
- Function: Private function
- Resource: DSC class-based resource
Build & Test Workflow Requirements
- Run PowerShell script files from repository root
- Setup build and test environment (once per
pwshsession):./build.ps1 -Tasks noop- Build project before running tests:
./build.ps1 -Tasks build- Always run tests in new
pwshsession:Invoke-Pester -Path @({test paths}) -Output DetailedFile Organization
- Public commands:
source/Public/{CommandName}.ps1- Private functions:
source/Private/{FunctionName}.ps1- Unit tests:
tests/Unit/{Classes|Public|Private}/{Name}.Tests.ps1- Integration tests:
tests/Integration/Commands/{CommandName}.Integration.Tests.ps1Requirements
- Follow instructions over existing code patterns
- Follow PowerShell style and test guideline instructions strictly
- Always update CHANGELOG.md Unreleased section
- Localize all strings using string keys; remove any orphaned string keys
- Check DscResource.Common before creating private functions
- Separate reusable logic into private functions
- DSC resources should always be created as class-based resources
- Add unit tests for all commands/functions/resources
- Add integration tests for all public commands and resources
Files:
- source/Modules/xRemoteDesktopSessionHost.Common/xRemoteDesktopSessionHost.Common.psd1
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1
- source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1
- source/DSCResources/MSFT_xRDServer/MSFT_xRDServer.psm1
- tests/Unit/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.Tests.ps1
- build.yaml
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- azure-pipelines.yml
- CHANGELOG.md
- source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
- source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1
- tests/Unit/MSFT_xRDServer.Tests.ps1
- tests/Unit/MSFT_xRDSessionCollection.Tests.ps1
- tests/Unit/MSFT_xRDGatewayConfiguration.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Get-xRemoteDesktopSessionHostOsVersion.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
- tests/Unit/MSFT_xRDLicenseConfiguration.Tests.ps1
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
- source/DSCResources/MSFT_xRDGatewayConfiguration/MSFT_xRDGatewayConfiguration.psm1
- source/DSCResources/MSFT_xRDConnectionBrokerHAMode/MSFT_xRDConnectionBrokerHAMode.psm1
- RequiredModules.psd1
{**/*.ps1,**/*.psm1,**/*.psd1}
⚙️ CodeRabbit configuration file
{**/*.ps1,**/*.psm1,**/*.psd1}: # PowerShell GuidelinesNaming
- Use descriptive names (3+ characters, no abbreviations)
- Functions: PascalCase with Verb-Noun format using approved verbs
- Parameters: PascalCase
- Variables: camelCase
- Keywords: lower-case
- Classes: PascalCase
- Include scope for script/global/environment variables:
$script:,$global:,$env:File naming
- Class files:
###.ClassName.ps1format (e.g.001.SqlReason.ps1,004.StartupParameters.ps1)Formatting
Indentation & Spacing
- Use 4 spaces (no tabs)
- One space around operators:
$a = 1 + 2- One space between type and variable:
[String] $name- One space between keyword and parenthesis:
if ($condition)- No spaces on empty lines
- Try to limit lines to 120 characters
Braces
- Newline before opening brace (except variable assignments)
- One newline after opening brace
- Two newlines after closing brace (one if followed by another brace or continuation)
Quotes
- Use single quotes unless variable expansion is needed:
'text'vs"text $variable"Arrays
- Single line:
@('one', 'two', 'three')- Multi-line: each element on separate line with proper indentation
- Do not use the unary comma operator (
,) in return statements to force
an arrayHashtables
- Empty:
@{}- Each property on separate line with proper indentation
- Properties: Use PascalCase
Comments
- Single line:
# Comment(capitalized, on own line)- Multi-line:
<# Comment #>format (opening and closing brackets on own line), and indent text- No commented-out code
Comment-based help
- Always add comment-based help to all functions and scripts
- Comment-based help: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, EXAMPLE sections before function/class
- Comment-based help indentation: keywords 4 spaces, text 8 spaces
- Include examples for all parameter sets and combinations
- INPUTS: List each pipeline‑accepted type (one per line) with a 1‑line description...
Files:
- source/Modules/xRemoteDesktopSessionHost.Common/xRemoteDesktopSessionHost.Common.psd1
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1
- source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1
- source/DSCResources/MSFT_xRDServer/MSFT_xRDServer.psm1
- tests/Unit/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.Tests.ps1
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
- source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1
- tests/Unit/MSFT_xRDServer.Tests.ps1
- tests/Unit/MSFT_xRDSessionCollection.Tests.ps1
- tests/Unit/MSFT_xRDGatewayConfiguration.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Get-xRemoteDesktopSessionHostOsVersion.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
- tests/Unit/MSFT_xRDLicenseConfiguration.Tests.ps1
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
- source/DSCResources/MSFT_xRDGatewayConfiguration/MSFT_xRDGatewayConfiguration.psm1
- source/DSCResources/MSFT_xRDConnectionBrokerHAMode/MSFT_xRDConnectionBrokerHAMode.psm1
- RequiredModules.psd1
tests/[Uu]nit/**/*.[Tt]ests.ps1
⚙️ CodeRabbit configuration file
tests/[Uu]nit/**/*.[Tt]ests.ps1: # Unit Tests Guidelines
- Test with localized strings: Use
InModuleScope -ScriptBlock { $script:localizedData.Key }- Mock files: Use
$TestDrivevariable (path to the test drive)- All public commands require parameter set validation tests
- After modifying classes, always run tests in new session (for changes to take effect)
Test Setup Requirements
Use this exact setup block before
Describe:[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Suppressing this rule because Script Analyzer does not understand Pester syntax.')] param () BeforeDiscovery { try { if (-not (Get-Module -Name 'DscResource.Test')) { # Assumes dependencies have been resolved, so if this module is not available, run 'noop' task. if (-not (Get-Module -Name 'DscResource.Test' -ListAvailable)) { # Redirect all streams to $null, except the error stream (stream 2) & "$PSScriptRoot/../../../build.ps1" -Tasks 'noop' 3>&1 4>&1 5>&1 6>&1 > $null } # If the dependencies have not been resolved, this will throw an error. Import-Module -Name 'DscResource.Test' -Force -ErrorAction 'Stop' } } catch [System.IO.FileNotFoundException] { throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks noop" first.' } } BeforeAll { $script:moduleName = '{MyModuleName}' Import-Module -Name $script:moduleName -Force -ErrorAction 'Stop' $PSDefaultParameterValues['InModuleScope:ModuleName'] = $script:moduleName $PSDefaultParameterValues['Mock:ModuleName'] = $script:moduleName $PSDefaultParameterValues['Should:ModuleName'] = $script:moduleName } AfterAll { $PSDefaultParameterValues.Remove('InModuleScope:ModuleName') $PSDefaultParameterValues.Remove('Mock:ModuleNam...
Files:
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1
- tests/Unit/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.Tests.ps1
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- tests/Unit/MSFT_xRDServer.Tests.ps1
- tests/Unit/MSFT_xRDSessionCollection.Tests.ps1
- tests/Unit/MSFT_xRDGatewayConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDLicenseConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
**/*.[Tt]ests.ps1
⚙️ CodeRabbit configuration file
**/*.[Tt]ests.ps1: # Tests GuidelinesCore Requirements
- All public commands, private functions and classes must have unit tests
- All public commands and class-based resources must have integration tests
- Use Pester v5 syntax only
- Test code only inside
Describeblocks- Assertions only in
Itblocks- Never test verbose messages, debug messages or parameter binding behavior
- Pass all mandatory parameters to avoid prompts
Requirements
- Inside
Itblocks, assign unused return objects to$null(unless part of pipeline)- Tested entity must be called from within the
Itblocks- Keep results and assertions in same
Itblock- Avoid try-catch-finally for cleanup, use
AfterAllorAfterEach- Avoid unnecessary remove/recreate cycles
Naming
- One
Describeblock per file matching the tested entity name
Contextdescriptions start with 'When'
Itdescriptions start with 'Should', must not contain 'when'- Mock variables prefix: 'mock'
Structure & Scope
- Public commands: Never use
InModuleScope(unless retrieving localized strings)- Private functions/class resources: Always use
InModuleScope- Each class method = separate
Contextblock- Each scenario = separate
Contextblock- Use nested
Contextblocks for complex scenarios- Mocking in
BeforeAll(BeforeEachonly when required)- Setup/teardown in
BeforeAll,BeforeEach/AfterAll,AfterEachclose to usageSyntax Rules
- PascalCase:
Describe,Context,It,Should,BeforeAll,BeforeEach,AfterAll,AfterEach- Use
-BeTrue/-BeFalsenever-Be $true/-Be $false- Never use
Assert-MockCalled, useShould -Invokeinstead- No
Should -Not -Throw- invoke commands directly- Never add an empty
-MockWithblock- Omit
-MockWithwhen returning$null- Set
$PSDefaultParameterValuesforMock:ModuleName,Should:ModuleName,InModuleScope:ModuleName- Omit
-ModuleNameparameter on Pester commands- Never use
Mockinside `InModuleSc...
Files:
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1
- tests/Unit/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.Tests.ps1
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- tests/Unit/MSFT_xRDServer.Tests.ps1
- tests/Unit/MSFT_xRDSessionCollection.Tests.ps1
- tests/Unit/MSFT_xRDGatewayConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDLicenseConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
source/DSCResources/**/*.psm1
⚙️ CodeRabbit configuration file
source/DSCResources/**/*.psm1: # MOF-based Desired State Configuration (DSC) Resources GuidelinesRequired Functions
- Every DSC resource must define:
Get-TargetResource,Set-TargetResource,Test-TargetResource- Export using
*-TargetResourcepatternFunction Return Types
Get-TargetResource: Must return hashtable with all resource properties
Test-TargetResource: Must return boolean ($true/$false)
Set-TargetResource: Must not return anything (void)Parameter Guidelines
Get-TargetResource: Only include parameters needed to retrieve actual current state values
Get-TargetResource: Remove non-mandatory parameters that are never used
Set-TargetResourceandTest-TargetResource: Must have identical parameters
Set-TargetResourceandTest-TargetResource: Unused mandatory parameters: Add "Not used in <function_name>" to help commentRequired Elements
- Each function must include
Write-Verboseat least once
Get-TargetResource: Use verbose message starting with "Getting the current state of..."
Set-TargetResource: Use verbose message starting with "Setting the desired state of..."
Test-TargetResource: Use verbose message starting with "Determining the current state of..."- Use localized strings for all messages (Write-Verbose, Write-Error, etc.)
- Import localized strings using
Get-LocalizedDataat module topError Handling
- Do not use
throwfor terminating errors- Use
try/catchblocks to handle exceptions- Throw localized exceptions using the appropriate
New-*Exceptioncmdlet:
New‑InvalidDataException
New-ArgumentException
New-InvalidOperationException- [
New-ObjectNotFoundException](https:/...
Files:
- source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1
- source/DSCResources/MSFT_xRDServer/MSFT_xRDServer.psm1
- source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
- source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1
- source/DSCResources/MSFT_xRDGatewayConfiguration/MSFT_xRDGatewayConfiguration.psm1
- source/DSCResources/MSFT_xRDConnectionBrokerHAMode/MSFT_xRDConnectionBrokerHAMode.psm1
**/*.md
⚙️ CodeRabbit configuration file
**/*.md: # Markdown Style Guidelines
- Wrap lines at word boundaries when over 80 characters (except tables/code blocks)
- Use 2 spaces for indentation
- Use '1.' for all items in ordered lists (1/1/1 numbering style)
- Disable
MD013rule by adding a comment for tables/code blocks exceeding 80 characters- Empty lines required before/after code blocks and headings (except before line 1)
- Escape backslashes in file paths only (not in code blocks)
- Code blocks must specify language identifiers
Text Formatting
- Parameters: bold
- Values/literals:
inline code- Resource/module/product names: italic
- Commands/files/paths:
inline code
Files:
- CHANGELOG.md
CHANGELOG.md
⚙️ CodeRabbit configuration file
CHANGELOG.md: # Changelog Guidelines
- Always update the Unreleased section in CHANGELOG.md
- Use Keep a Changelog format
- Describe notable changes briefly, ≤2 items per change type
- Reference issues using format issue #<issue_number>
- No empty lines between list items in same section
- Skip adding entry if same change already exists in Unreleased section
- No duplicate sections or items in Unreleased section
Files:
- CHANGELOG.md
source/**/*.ps1
⚙️ CodeRabbit configuration file
source/**/*.ps1: # Localization GuidelinesRequirements
- Localize all Write-Debug, Write-Verbose, Write-Error, Write-Warning and $PSCmdlet.ThrowTerminatingError() messages
- Use localized string keys, not hardcoded strings
- Assume
$script:localizedDatais availableString Files
- Commands/functions:
source/en-US/{MyModuleName}.strings.psd1- Class resources:
source/en-US/{ResourceClassName}.strings.psd1Key Naming Patterns
- Format:
Verb_FunctionName_Action(underscore separators), e.g.Get_Database_ConnectingToDatabaseString Format
ConvertFrom-StringData @' KeyName = Message with {0} placeholder. (PREFIX0001) '@String IDs
- Format:
(PREFIX####)- PREFIX: First letter of each word in class or function name (SqlSetup → SS, Get-SqlDscDatabase → GSDD)
- Number: Sequential from 0001
Usage
Write-Verbose -Message ($script:localizedData.KeyName -f $value1)
Files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Get-xRemoteDesktopSessionHostOsVersion.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
🧠 Learnings (41)
📓 Common learnings
Learnt from: dan-hughes
PR: dsccommunity/UpdateServicesDsc#85
File: source/en-US/UpdateServicesDsc.strings.psd1:1-2
Timestamp: 2025-10-04T21:33:23.022Z
Learning: In UpdateServicesDsc (and similar DSC modules), the module-level localization file (source/en-US/<ModuleName>.strings.psd1) can be empty when DSC resources have their own localization files in source/DSCResources/<ResourceName>/en-US/DSC_<ResourceName>.strings.psd1. Automated tests verify localization completeness for resources. Don't flag empty module-level localization files as issues when resources have separate localization.
Learnt from: dan-hughes
PR: dsccommunity/ActiveDirectoryDsc#741
File: azure-pipelines.yml:104-104
Timestamp: 2025-08-10T15:11:52.897Z
Learning: In the ActiveDirectoryDsc project, HQRM (High Quality Resource Module) tests must run in PowerShell 5 (Windows PowerShell) using `pwsh: false` in the Azure Pipelines configuration, while unit tests can run in PowerShell 7 (PowerShell Core) with `pwsh: true`. This differentiation is intentional due to HQRM's specific requirements and dependencies on Windows PowerShell.
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-09-12T13:21:31.054Z
Learning: Applies to **/*.[Tt]ests.ps1 : Use Pester v5 syntax only
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : Include the exact Pester setup block before Describe: SuppressMessage attribute with param (); BeforeDiscovery to ensure DscResource.Test is available (fallback to build.ps1 -Tasks 'noop') and Import-Module; BeforeAll to set $script:moduleName, import the module, and set PSDefaultParameterValues for InModuleScope/Mock/Should; AfterAll to remove those defaults and unload the tested module
📚 Learning: 2025-09-16T16:34:44.689Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : Include the exact Pester setup block before Describe: SuppressMessage attribute with param (); BeforeDiscovery to ensure DscResource.Test is available (fallback to build.ps1 -Tasks 'noop') and Import-Module; BeforeAll to set $script:moduleName, import the module, and set PSDefaultParameterValues for InModuleScope/Mock/Should; AfterAll to remove those defaults and unload the tested module
Applied to files:
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1
- tests/Unit/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.Tests.ps1
- build.yaml
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- tests/Unit/MSFT_xRDServer.Tests.ps1
- tests/Unit/MSFT_xRDSessionCollection.Tests.ps1
- tests/Unit/MSFT_xRDGatewayConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDLicenseConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
📚 Learning: 2025-09-16T16:35:31.909Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-09-16T16:35:31.909Z
Learning: Applies to tests/Unit/{Classes,Public,Private}/*.Tests.ps1 : Add unit tests for all commands, functions, and resources
Applied to files:
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- tests/Unit/MSFT_xRDServer.Tests.ps1
- tests/Unit/MSFT_xRDSessionCollection.Tests.ps1
- tests/Unit/MSFT_xRDGatewayConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Test-TargetResource must return a boolean ($true/$false)
Applied to files:
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- tests/Unit/MSFT_xRDServer.Tests.ps1
- tests/Unit/MSFT_xRDSessionCollection.Tests.ps1
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Set-TargetResource and Test-TargetResource must have identical parameters
Applied to files:
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1
- source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
- tests/Unit/MSFT_xRDSessionCollection.Tests.ps1
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
- source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
📚 Learning: 2025-10-10T14:01:42.703Z
Learnt from: dan-hughes
PR: dsccommunity/UpdateServicesDsc#86
File: tests/Unit/MSFT_UpdateServicesServer.Tests.ps1:6-45
Timestamp: 2025-10-10T14:01:42.703Z
Learning: For script-based (MOF) DSC resources in UpdateServicesDsc, unit tests should use Initialize-TestEnvironment with variables $script:dscModuleName and $script:dscResourceName, and set -ResourceType 'Mof'. This differs from class-based resource tests which use the simpler $script:moduleName template without Initialize-TestEnvironment.
Applied to files:
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- tests/Unit/MSFT_xRDServer.Tests.ps1
- tests/Unit/MSFT_xRDLicenseConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Set-TargetResource must not return anything (void)
Applied to files:
- tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
- tests/Unit/MSFT_xRDSessionCollection.Tests.ps1
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Every MOF DSC resource module must define the functions: Get-TargetResource, Set-TargetResource, and Test-TargetResource
Applied to files:
- source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1
- tests/Unit/MSFT_xRDRemoteApp.Tests.ps1
- source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
- source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1
- tests/Unit/MSFT_xRDServer.Tests.ps1
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Export resource functions using the *-TargetResource naming pattern
Applied to files:
- source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
- source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Get-TargetResource must return a hashtable containing all resource properties
Applied to files:
- source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
- source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Get-TargetResource parameters: include only those needed to retrieve actual current state values
Applied to files:
- source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
- source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Get-TargetResource: remove non-mandatory parameters that are never used
Applied to files:
- source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1
- source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
- source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1
- source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1
📚 Learning: 2025-10-11T08:18:26.062Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2300
File: tests/Unit/DSC_SqlAGDatabase.Tests.ps1:22-22
Timestamp: 2025-10-11T08:18:26.062Z
Learning: In unit test files (tests/[Uu]nit/**/*.[Tt]ests.ps1), when DscResource.Test module dependency is not found during BeforeDiscovery setup, the error message should instruct users to run ".\build.ps1 -Tasks noop" (not "build") because the noop task is designed for quick test environment setup. The build task is more extensive and unnecessary when tests run in a separate process, as the module should already be built before running tests.
Applied to files:
- tests/Unit/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.Tests.ps1
📚 Learning: 2025-08-10T15:11:52.897Z
Learnt from: dan-hughes
PR: dsccommunity/ActiveDirectoryDsc#741
File: azure-pipelines.yml:104-104
Timestamp: 2025-08-10T15:11:52.897Z
Learning: In the ActiveDirectoryDsc project, HQRM (High Quality Resource Module) tests must run in PowerShell 5 (Windows PowerShell) using `pwsh: false` in the Azure Pipelines configuration, while unit tests can run in PowerShell 7 (PowerShell Core) with `pwsh: true`. This differentiation is intentional due to HQRM's specific requirements and dependencies on Windows PowerShell.
Applied to files:
- tests/Unit/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.Tests.ps1
- build.yaml
📚 Learning: 2025-09-23T10:20:59.832Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-09-23T10:20:59.832Z
Learning: Run QA tests via: Invoke-PesterJob -Path 'tests/QA' -SkipCodeCoverage
Applied to files:
- build.yaml
📚 Learning: 2025-09-23T10:20:59.832Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-09-23T10:20:59.832Z
Learning: Run tests with Invoke-PesterJob (wildcards allowed) with coverage using -EnableSourceLineMapping and -FilterCodeCoverageResult
Applied to files:
- build.yaml
📚 Learning: 2025-09-23T10:20:59.832Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-09-23T10:20:59.832Z
Learning: Run tests with Invoke-PesterJob (wildcards allowed) without coverage using -SkipCodeCoverage
Applied to files:
- build.yaml
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1 : Include the required Pester setup block (SuppressMessage param, BeforeDiscovery loading DscResource.Test, and BeforeAll importing the module)
Applied to files:
- build.yaml
📚 Learning: 2025-09-12T13:21:31.054Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-09-12T13:21:31.054Z
Learning: Applies to **/*.[Tt]ests.ps1 : Use Pester v5 syntax only
Applied to files:
- build.yaml
📚 Learning: 2025-09-12T13:21:31.054Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-09-12T13:21:31.054Z
Learning: Applies to **/*.[Tt]ests.ps1 : Omit the -ModuleName parameter on Pester commands
Applied to files:
- build.yaml
📚 Learning: 2025-08-28T15:44:12.628Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2150
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:35-35
Timestamp: 2025-08-28T15:44:12.628Z
Learning: The SqlServerDsc repository uses RequiredModules.psd1 to specify Pester with Version = 'latest' and AllowPrerelease = $true, ensuring the latest Pester version (well beyond 5.4) is available, which supports Should -Invoke syntax and other modern Pester features.
Applied to files:
- build.yaml
- RequiredModules.psd1
📚 Learning: 2025-10-11T08:35:56.141Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2300
File: tests/Unit/DSC_SqlAGDatabase.Tests.ps1:22-22
Timestamp: 2025-10-11T08:35:56.141Z
Learning: In DSC Community projects, when writing error messages for missing DscResource.Test module dependency in unit test files (tests/[Uu]nit/**/*.[Tt]ests.ps1), the policy is: new code should instruct users to run ".\build.ps1 -Tasks noop" for quick test environment setup; existing code using ".\build.ps1 -Tasks build" is acceptable but slower since it also builds the project. The `noop` task is preferred as it assumes the module is already built before running tests, especially when tests run in a separate process.
Applied to files:
- build.yaml
📚 Learning: 2025-09-12T13:21:31.054Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-09-12T13:21:31.054Z
Learning: Applies to **/*.[Tt]ests.ps1 : Use $PSDefaultParameterValues only for Pester commands (Describe, Context, It, Mock, Should, InModuleScope)
Applied to files:
- build.yaml
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Import localized strings at the top of the module using Get-LocalizedData
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
- source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
📚 Learning: 2025-10-04T21:33:23.022Z
Learnt from: dan-hughes
PR: dsccommunity/UpdateServicesDsc#85
File: source/en-US/UpdateServicesDsc.strings.psd1:1-2
Timestamp: 2025-10-04T21:33:23.022Z
Learning: In UpdateServicesDsc (and similar DSC modules), the module-level localization file (source/en-US/<ModuleName>.strings.psd1) can be empty when DSC resources have their own localization files in source/DSCResources/<ResourceName>/en-US/DSC_<ResourceName>.strings.psd1. Automated tests verify localization completeness for resources. Don't flag empty module-level localization files as issues when resources have separate localization.
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
📚 Learning: 2025-09-12T13:20:14.850Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-class-resource.instructions.md:0-0
Timestamp: 2025-09-12T13:20:14.850Z
Learning: Applies to source/[cC]lasses/**/*.ps1 : Use $this.localizedData provided by ResourceBase (do not manually populate)
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/[a-z][a-z]-[A-Z][A-Z]/DSC_*.strings.psd1 : Additional localization folders must be named using Get-UICulture names (e.g., fr-FR) and contain DSC_<ResourceName>.strings.psd1
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Use localized strings for all messages (e.g., Write-Verbose, Write-Error)
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/en-US/DSC_*.strings.psd1 : Each resource directory must contain an en-US localization folder with a strings file named DSC_<ResourceName>.strings.psd1
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
📚 Learning: 2025-08-29T17:22:23.268Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-localization.instructions.md:0-0
Timestamp: 2025-08-29T17:22:23.268Z
Learning: Applies to source/**/*.ps1 : Assume and use $script:localizedData for accessing localized strings
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
📚 Learning: 2025-09-16T16:34:44.689Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : In unit tests, access localized strings using InModuleScope -ScriptBlock { $script:localizedData.Key }
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
📚 Learning: 2025-08-29T17:22:23.268Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-localization.instructions.md:0-0
Timestamp: 2025-08-29T17:22:23.268Z
Learning: Applies to source/**/*.ps1 : Use localized string keys instead of hardcoded strings in script output/messages
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1
📚 Learning: 2025-08-17T10:48:15.384Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2136
File: source/suffix.ps1:24-24
Timestamp: 2025-08-17T10:48:15.384Z
Learning: In source/suffix.ps1, the Write-Verbose message in the catch block for Import-SqlDscPreferredModule does not need localization because the exception message from Import-SqlDscPreferredModule is already localized by that command, making it an edge case exception to the localization guidelines.
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/prefix.ps1
📚 Learning: 2025-08-29T17:22:23.268Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-localization.instructions.md:0-0
Timestamp: 2025-08-29T17:22:23.268Z
Learning: Applies to source/en-US/*.strings.psd1 : Store command/function localization in source/en-US/{MyModuleName}.strings.psd1
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
📚 Learning: 2025-08-29T17:22:23.268Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-localization.instructions.md:0-0
Timestamp: 2025-08-29T17:22:23.268Z
Learning: Applies to source/en-US/*.strings.psd1 : Store class localization in source/en-US/{ResourceClassName}.strings.psd1
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
📚 Learning: 2025-08-29T17:22:23.268Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-localization.instructions.md:0-0
Timestamp: 2025-08-29T17:22:23.268Z
Learning: Applies to source/en-US/*.strings.psd1 : Define strings using ConvertFrom-StringData with entries like `KeyName = Message with {0} placeholder. (PREFIX0001)`
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/[a-z][a-z]-[A-Z][A-Z]/DSC_*.strings.psd1 : In .strings.psd1 files, use underscores as word separators in localized string key names for multi-word keys
Applied to files:
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
📚 Learning: 2025-08-29T17:22:23.268Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-localization.instructions.md:0-0
Timestamp: 2025-08-29T17:22:23.268Z
Learning: Applies to source/en-US/*.strings.psd1 : Include string IDs in the form (PREFIX####), where PREFIX is initials from the class/function name and numbers are sequential from 0001
Applied to files:
- source/en-US/xRemoteDesktopSessionHost.strings.psd1
📚 Learning: 2025-09-16T16:35:31.909Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-09-16T16:35:31.909Z
Learning: Applies to tests/Integration/Commands/*.Integration.Tests.ps1 : Add integration tests for all public commands (and resources)
Applied to files:
- tests/Unit/MSFT_xRDSessionDeployment.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Each of Get-/Set-/Test-TargetResource must include at least one Write-Verbose call
Applied to files:
- tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1
📚 Learning: 2025-08-28T15:44:12.628Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2150
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:35-35
Timestamp: 2025-08-28T15:44:12.628Z
Learning: The repository uses RequiredModules.psd1 to specify Pester version requirements with RequiredVersion = 'latest', which ensures compatibility with Should -Invoke syntax (requires Pester 5.4+).
Applied to files:
- RequiredModules.psd1
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: dsccommunity.xRemoteDesktopSessionHost (Build Package Module)
🔇 Additional comments (20)
source/en-US/xRemoteDesktopSessionHost.strings.psd1 (1)
1-4: LGTM! Empty module-level localization file is acceptable.Based on learnings, empty module-level localization files are acceptable when DSC resources have their own localization files. Automated tests verify localization completeness for resources.
CHANGELOG.md (1)
35-35: LGTM!The CHANGELOG entry correctly documents the Pester 5 migration and references the corresponding issue.
source/Modules/xRemoteDesktopSessionHost.Common/en-US/xRemoteDesktopSessionHost.Common.strings.psd1 (1)
1-4: LGTM! Empty localization file is acceptable.This empty localization file follows the established pattern. Based on learnings, automated tests verify localization completeness.
tests/Unit/MSFT_xRDCertificateConfiguration.Tests.ps1 (1)
1-313: LGTM! Excellent Pester 5 implementation.This test file correctly follows the required Pester 5 template:
- Proper SuppressMessage attributes and param()
- BeforeDiscovery ensures DscResource.Test is available
- BeforeAll sets up test environment with Initialize-TestEnvironment for MOF resources
- PSDefaultParameterValues correctly configured
- Uses Should -Invoke instead of deprecated Assert-MockCalled
- Proper cleanup in AfterAll
- Good test coverage for Get-/Test-/Set-TargetResource
RequiredModules.psd1 (2)
12-12: LGTM! Pester version update aligns with migration goals.Updating Pester to 'latest' ensures compatibility with Pester 5 syntax and features, which is the primary objective of this PR.
Based on learnings.
27-27: LGTM! Adding analyzer rules improves code quality.The addition of
Indented.ScriptAnalyzerRulesprovides additional static analysis capabilities to maintain code quality.azure-pipelines.yml (1)
113-113: LGTM! Unit tests now run in PowerShell Core.This change aligns with the Pester 5 migration objectives and follows the correct pattern where unit tests run in PowerShell 7 (pwsh: true) while HQRM tests continue to run in Windows PowerShell (pwsh: false at line 78).
Based on learnings.
source/DSCResources/MSFT_xRDGatewayConfiguration/MSFT_xRDGatewayConfiguration.psm1 (2)
1-12: LGTM! Consistent module loading pattern.The refactored module loading approach:
- Dynamically resolves the module path
- Imports both common modules (xRemoteDesktopSessionHost.Common and DscResource.Common)
- Explicitly asserts RemoteDesktop module availability using
Assert-ModuleThis pattern is consistent across all DSC resources in this PR and provides better dependency management.
206-206: LGTM! Named parameters improve clarity.Using named parameters instead of positional parameters makes the function call more explicit and maintainable.
source/DSCResources/MSFT_xRDLicenseConfiguration/MSFT_xRDLicenseConfiguration.psm1 (1)
1-12: LGTM! Consistent with module-wide refactor pattern.This resource adopts the same module loading and dependency assertion pattern as other resources in this PR, ensuring consistency across the module.
.vscode/settings.json (1)
48-57: LGTM! VSCode configuration supports Pester 5 workflow.These settings enable proper Pester 5 test discovery and execution in VSCode:
- Test file patterns match the repository structure
- Module path points to the built RequiredModules directory
- CodeLens and new process settings optimize the testing experience
source/DSCResources/MSFT_xRDServer/MSFT_xRDServer.psm1 (1)
1-13: LGTM! Consistent module loading pattern applied.This resource follows the same refactored module loading approach as other resources in this PR, ensuring consistent dependency management across the module.
source/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1 (1)
1-12: LGTM! Completes consistent refactor across all DSC resources.This resource adopts the standardized module loading pattern, completing the refactor across all DSC resources in the module. The consistent approach improves maintainability and dependency management.
source/DSCResources/MSFT_xRDCertificateConfiguration/MSFT_xRDCertificateConfiguration.psm1 (1)
1-6: Good: standardized imports, localization, and module assertionUse of Get-LocalizedData and Assert-Module -ImportModule looks correct and consistent with DSC guidelines. Please align other resources similarly (RemoteApp/SessionCollection).
As per coding guidelines
Also applies to: 12-12, 42-43, 80-81
source/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1 (2)
1-6: Dynamic module path + common imports look goodResolves submodule paths robustly and imports shared utilities as intended. Consider verifying this still resolves correctly from the built module location.
12-12: RemoteDesktop dependency checkSwitching to Assert-Module is fine and keeps behavior explicit.
source/DSCResources/MSFT_xRDConnectionBrokerHAMode/MSFT_xRDConnectionBrokerHAMode.psm1 (2)
1-6: Common module path + importsLGTM. Consistent with other resources and build layout.
12-12: RemoteDesktop dependency assertionLGTM.
source/Modules/xRemoteDesktopSessionHost.Common/xRemoteDesktopSessionHost.Common.psd1 (1)
12-12: RootModule renameOK if the psm1 aligns with file system. No action.
build.yaml (1)
22-29: Submodule packaging looks correctPrefix, copy paths, and exclusions for xRemoteDesktopSessionHost.Common look consistent with import by path in resources/tests.
        
          
                source/DSCResources/MSFT_xRDConnectionBrokerHAMode/MSFT_xRDConnectionBrokerHAMode.psm1
          
            Show resolved
            Hide resolved
        
              
          
                ...e/Modules/xRemoteDesktopSessionHost.Common/Public/Get-xRemoteDesktopSessionHostOsVersion.ps1
          
            Show resolved
            Hide resolved
        
              
          
                ...ules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
          
            Show resolved
            Hide resolved
        
              
          
                ...RemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.Tests.ps1
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
- Resolve-Dependency.psd1(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**
⚙️ CodeRabbit configuration file
**: # DSC Community GuidelinesTerminology
- Command: Public command
- Function: Private function
- Resource: DSC class-based resource
Build & Test Workflow Requirements
- Run PowerShell script files from repository root
- Setup build and test environment (once per
pwshsession):./build.ps1 -Tasks noop- Build project before running tests:
./build.ps1 -Tasks build- Always run tests in new
pwshsession:Invoke-Pester -Path @({test paths}) -Output DetailedFile Organization
- Public commands:
source/Public/{CommandName}.ps1- Private functions:
source/Private/{FunctionName}.ps1- Unit tests:
tests/Unit/{Classes|Public|Private}/{Name}.Tests.ps1- Integration tests:
tests/Integration/Commands/{CommandName}.Integration.Tests.ps1Requirements
- Follow instructions over existing code patterns
- Follow PowerShell style and test guideline instructions strictly
- Always update CHANGELOG.md Unreleased section
- Localize all strings using string keys; remove any orphaned string keys
- Check DscResource.Common before creating private functions
- Separate reusable logic into private functions
- DSC resources should always be created as class-based resources
- Add unit tests for all commands/functions/resources
- Add integration tests for all public commands and resources
Files:
- Resolve-Dependency.psd1
{**/*.ps1,**/*.psm1,**/*.psd1}
⚙️ CodeRabbit configuration file
{**/*.ps1,**/*.psm1,**/*.psd1}: # PowerShell GuidelinesNaming
- Use descriptive names (3+ characters, no abbreviations)
- Functions: PascalCase with Verb-Noun format using approved verbs
- Parameters: PascalCase
- Variables: camelCase
- Keywords: lower-case
- Classes: PascalCase
- Include scope for script/global/environment variables:
$script:,$global:,$env:File naming
- Class files:
###.ClassName.ps1format (e.g.001.SqlReason.ps1,004.StartupParameters.ps1)Formatting
Indentation & Spacing
- Use 4 spaces (no tabs)
- One space around operators:
$a = 1 + 2- One space between type and variable:
[String] $name- One space between keyword and parenthesis:
if ($condition)- No spaces on empty lines
- Try to limit lines to 120 characters
Braces
- Newline before opening brace (except variable assignments)
- One newline after opening brace
- Two newlines after closing brace (one if followed by another brace or continuation)
Quotes
- Use single quotes unless variable expansion is needed:
'text'vs"text $variable"Arrays
- Single line:
@('one', 'two', 'three')- Multi-line: each element on separate line with proper indentation
- Do not use the unary comma operator (
,) in return statements to force
an arrayHashtables
- Empty:
@{}- Each property on separate line with proper indentation
- Properties: Use PascalCase
Comments
- Single line:
# Comment(capitalized, on own line)- Multi-line:
<# Comment #>format (opening and closing brackets on own line), and indent text- No commented-out code
Comment-based help
- Always add comment-based help to all functions and scripts
- Comment-based help: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, EXAMPLE sections before function/class
- Comment-based help indentation: keywords 4 spaces, text 8 spaces
- Include examples for all parameter sets and combinations
- INPUTS: List each pipeline‑accepted type (one per line) with a 1‑line description...
Files:
- Resolve-Dependency.psd1
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-09-12T13:21:31.054Z
Learning: Applies to **/*.[Tt]ests.ps1 : Use Pester v5 syntax only
Learnt from: dan-hughes
PR: dsccommunity/ActiveDirectoryDsc#741
File: azure-pipelines.yml:104-104
Timestamp: 2025-08-10T15:11:52.897Z
Learning: In the ActiveDirectoryDsc project, HQRM (High Quality Resource Module) tests must run in PowerShell 5 (Windows PowerShell) using `pwsh: false` in the Azure Pipelines configuration, while unit tests can run in PowerShell 7 (PowerShell Core) with `pwsh: true`. This differentiation is intentional due to HQRM's specific requirements and dependencies on Windows PowerShell.
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2150
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:35-35
Timestamp: 2025-08-28T15:44:12.628Z
Learning: The repository uses RequiredModules.psd1 to specify Pester version requirements with RequiredVersion = 'latest', which ensures compatibility with Should -Invoke syntax (requires Pester 5.4+).
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: dsccommunity.xRemoteDesktopSessionHost (Quality Test and Unit Test Unit Windows Server 2025)
- GitHub Check: dsccommunity.xRemoteDesktopSessionHost (Quality Test and Unit Test Unit Windows Server 2022)
- GitHub Check: dsccommunity.xRemoteDesktopSessionHost (Quality Test and Unit Test HQRM)
- GitHub Check: dsccommunity.xRemoteDesktopSessionHost (Build Package Module)
| @coderabbitai pause | 
| ✅ Actions performedReviews paused. | 
| Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@         Coverage Diff         @@
##           main   #122   +/-   ##
===================================
+ Coverage    90%    97%   +7%     
===================================
  Files        10      9    -1     
  Lines       556    539   -17     
===================================
+ Hits        503    526   +23     
+ Misses       53     13   -40     
 🚀 New features to boost your workflow:
 | 
| @coderabbitai review | 
| ✅ Actions performedReview triggered. 
 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️  Outside diff range comments (5)
source/DSCResources/MSFT_xRDConnectionBrokerHAMode/MSFT_xRDConnectionBrokerHAMode.psm1 (1)
58-64: Return the actual secondary connection string.Line [63] now sets
DatabaseSecondaryConnectionStringto the incoming parameter, not the value reported byGet-RDConnectionBrokerHighAvailability. This always mirrors the desired state and hides drift, soTest-TargetResourcewill return$trueeven when the cluster’s secondary string differs. Please return the property from the retrieved object instead.- DatabaseSecondaryConnectionString = $DatabaseSecondaryConnectionString + DatabaseSecondaryConnectionString = $ConnectionBrokerHighAvailability.DatabaseSecondaryConnectionStringsource/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1 (1)
135-138: Restore the CollectionName when removing hosts.Inside the Force-update path we call
Remove-RDSessionHostwithout-CollectionName, but that parameter is mandatory. At runtime the cmdlet throws a parameter binding error, so the resource never removes surplus hosts. Please include the collection name in the removal call.- foreach ($server in $surplus) - { - Remove-RDSessionHost -ConnectionBroker $ConnectionBroker -SessionHost $server - } + foreach ($server in $surplus) + { + Remove-RDSessionHost -ConnectionBroker $ConnectionBroker -CollectionName $CollectionName -SessionHost $server + }source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1 (1)
197-208: Skip Set-RDRemoteApp when nothing exists to remove.When the RemoteApp isn’t deployed and
EnsureisAbsent, we still fall through toSet-RDRemoteApp @PSBoundParameters, which raises “RemoteApp not found” and breaks idempotence. Bail out in that branch instead of calling Set.- elseif ($remoteApp -and $Ensure -eq 'Absent') - { - Remove-RDRemoteApp -CollectionName $CollectionName -Alias $Alias -Force - } - else - { - Set-RDRemoteApp @PSBoundParameters - } + elseif ($remoteApp -and $Ensure -eq 'Absent') + { + Remove-RDRemoteApp -CollectionName $CollectionName -Alias $Alias -Force + } + elseif ($remoteApp) + { + Set-RDRemoteApp @PSBoundParameters + }source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1 (2)
328-352: Throw the ArgumentException so validation actually stops
The new validation branches callNew-ArgumentException, but the returned exception is never thrown. As written, the code just logs and then continues intoSet-RDSessionCollectionConfigurationwith invalid values, which is exactly what this guard was supposed to prevent. Please wrap eachNew-ArgumentExceptioncall inthrow (...)so the function terminates when the validation fails.Apply this diff:
- if (-not(Test-Path -Path $DiskPath -ErrorAction SilentlyContinue)) - { - New-ArgumentException -ArgumentName 'DiskPath' -Message ('To enable UserProfileDisk we need a valid DiskPath. Path {0} not found' -f $DiskPath) - } + if (-not (Test-Path -Path $DiskPath -ErrorAction SilentlyContinue)) + { + throw (New-ArgumentException -ArgumentName 'DiskPath' -Message ('To enable UserProfileDisk we need a valid DiskPath. Path {0} not found' -f $DiskPath)) + } ... - New-ArgumentException -ArgumentName 'DiskPath' -Message 'No value found for parameter DiskPath. This is a mandatory parameter if EnableUserProfileDisk is set to True' + throw (New-ArgumentException -ArgumentName 'DiskPath' -Message 'No value found for parameter DiskPath. This is a mandatory parameter if EnableUserProfileDisk is set to True') ... - New-ArgumentException -ArgumentName 'MaxUserProfileDiskSizeGB' -Message ( - 'To enable UserProfileDisk we need a setting for MaxUserProfileDiskSizeGB that is greater than 0. Current value {0} is not valid' -f $MaxUserProfileDiskSizeGB - ) + throw (New-ArgumentException -ArgumentName 'MaxUserProfileDiskSizeGB' -Message ( + 'To enable UserProfileDisk we need a setting for MaxUserProfileDiskSizeGB that is greater than 0. Current value {0} is not valid' -f $MaxUserProfileDiskSizeGB + ))
515-552: Don’t remove parameters you still need to splat into Get-TargetResource
Test-TargetResourcenow callsGet-TargetResource @PSBoundParameters, but earlier in the function you deleteConnectionBrokerand, on down-level OS, evenCollectionNamefrom$PSBoundParameters. That creates two regressions:
- On Windows Server 2012 R2 (Major
< 10) the splatted call is missing the mandatoryCollectionNameparameter and throws.- Whenever a remote broker is targeted, the connection broker value is dropped, so the comparison silently queries the local broker instead of the one the user specified.
Please keep a separate splat for the
Get-TargetResourcecall (preserving the mandatory key properties) and only remove entries from the hash you pass intoTest-DscParameterState.Apply this diff:
- $null = $PSBoundParameters.Remove('Verbose') - $null = $PSBoundParameters.Remove('Debug') - $null = $PSBoundParameters.Remove('ConnectionBroker') + $null = $PSBoundParameters.Remove('Verbose') + $null = $PSBoundParameters.Remove('Debug') + + $getTargetResourceParams = @{ + CollectionName = $CollectionName + } + + if ($PSBoundParameters.ContainsKey('ConnectionBroker')) + { + $getTargetResourceParams.ConnectionBroker = $ConnectionBroker + $null = $PSBoundParameters.Remove('ConnectionBroker') + } @@ - $null = $PSBoundParameters.Remove('CollectionName') + $null = $PSBoundParameters.Remove('CollectionName') @@ - $testDscParameterStateSplat = @{ - CurrentValues = Get-TargetResource -CollectionName $CollectionName + $testDscParameterStateSplat = @{ + CurrentValues = Get-TargetResource @getTargetResourceParams
♻️ Duplicate comments (2)
tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1 (1)
59-121: Remove the legacy commented-out suite.The entire Pester v4 block is still commented out, which violates our “no commented-out code” guideline and creates maintenance noise. Please delete this obsolete block now that the Pester 5 tests cover the scenarios. As per coding guidelines.
source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1 (1)
1-4: Add required command metadata and help.This public function still misses the mandated comment-based help,
[CmdletBinding()], and[OutputType([System.Boolean])], and it should use the fully qualified[System.Version]constructor. Please bring it in line with the module’s PowerShell guidelines.+<# + .SYNOPSIS + Verifies that the operating system meets the Remote Desktop Session Host requirement. + + .DESCRIPTION + Returns $true when Get-xRemoteDesktopSessionHostOsVersion reports at least Windows Server 2012 (6.2.9200.0); otherwise returns $false. + + .OUTPUTS + System.Boolean + + Indicates whether the OS version is supported. +#> function Test-xRemoteDesktopSessionHostOsRequirement { - return (Get-xRemoteDesktopSessionHostOsVersion) -ge ([Version]::new(6, 2, 9200, 0)) + [CmdletBinding()] + [OutputType([System.Boolean])] + param () + + return (Get-xRemoteDesktopSessionHostOsVersion) -ge [System.Version]::new(6, 2, 9200, 0) }
🧹 Nitpick comments (6)
tests/Unit/MSFT_xRDSessionCollection.Tests.ps1 (1)
21-24: Align dependency hint with noop guidance.Line 23 still tells contributors to run
.\build.ps1 -ResolveDependency -Tasks build, which contradicts the current DSC guidance to use the faster noop task. Please update the message to match the template we use elsewhere.- throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks build" first.' + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -Tasks noop" first.'Based on learnings
tests/Unit/MSFT_xRDLicenseConfiguration.Tests.ps1 (1)
21-24: Fix the dependency resolution guidance.Line [23] still instructs contributors to run
. \build.ps1 -ResolveDependency -Tasks build, but the project guidance (and retrieved learnings) require pointing them to the fasternooptask. Please update the message accordingly.- throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks build" first.' + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks noop" first.'Based on learnings
tests/Unit/MSFT_xRDSessionCollectionConfiguration.Tests.ps1 (2)
21-24: Fix the dependency resolution guidance.Line [23] still directs maintainers to run
. \build.ps1 -ResolveDependency -Tasks build, but the documented guidance is to use the lighternooptask. Please update the message so it matches the standard template.- throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks build" first.' + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks noop" first.'Based on learnings
606-683: Remove the commented-out legacy tests.Lines [606-683] are the old Pester v4 suite left commented out. The PowerShell guidelines prohibit keeping commented-out code, so please delete this block entirely now that the Pester 5 implementation is in place.
As per coding guidelines
tests/Unit/MSFT_xRDServer.Tests.ps1 (1)
21-24: Fix the dependency resolution guidance.Line [23] still references
. \build.ps1 -ResolveDependency -Tasks build, but the approved template (per retrieved learnings) tells contributors to run thenooptask instead. Please update the string.- throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks build" first.' + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks noop" first.'Based on learnings
tests/Unit/MSFT_xRDGatewayConfiguration.Tests.ps1 (1)
390-390: Update the Describe title to the correct resource.The final
Describestill referencesMSFT_xRDLicenseConfiguration, which makes the Pester output misleading while you’re exercising the gateway configuration tests. Please rename it to the matchingMSFT_xRDGatewayConfigurationscope so failures point at the right resource.
| @coderabbitai resume | 
| ✅ Actions performedReviews resumed. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
- CHANGELOG.md(1 hunks)
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1(1 hunks)
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- CHANGELOG.md
🧰 Additional context used
📓 Path-based instructions (5)
**
⚙️ CodeRabbit configuration file
**: # DSC Community GuidelinesTerminology
- Command: Public command
- Function: Private function
- Resource: DSC class-based resource
Build & Test Workflow Requirements
- Run PowerShell script files from repository root
- Setup build and test environment (once per
pwshsession):./build.ps1 -Tasks noop- Build project before running tests:
./build.ps1 -Tasks build- Always run tests in new
pwshsession:Invoke-Pester -Path @({test paths}) -Output DetailedFile Organization
- Public commands:
source/Public/{CommandName}.ps1- Private functions:
source/Private/{FunctionName}.ps1- Unit tests:
tests/Unit/{Classes|Public|Private}/{Name}.Tests.ps1- Integration tests:
tests/Integration/Commands/{CommandName}.Integration.Tests.ps1Requirements
- Follow instructions over existing code patterns
- Follow PowerShell style and test guideline instructions strictly
- Always update CHANGELOG.md Unreleased section
- Localize all strings using string keys; remove any orphaned string keys
- Check DscResource.Common before creating private functions
- Separate reusable logic into private functions
- DSC resources should always be created as class-based resources
- Add unit tests for all commands/functions/resources
- Add integration tests for all public commands and resources
Files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
tests/[Uu]nit/**/*.[Tt]ests.ps1
⚙️ CodeRabbit configuration file
tests/[Uu]nit/**/*.[Tt]ests.ps1: # Unit Tests Guidelines
- Test with localized strings: Use
InModuleScope -ScriptBlock { $script:localizedData.Key }- Mock files: Use
$TestDrivevariable (path to the test drive)- All public commands require parameter set validation tests
- After modifying classes, always run tests in new session (for changes to take effect)
Test Setup Requirements
Use this exact setup block before
Describe:[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Suppressing this rule because Script Analyzer does not understand Pester syntax.')] param () BeforeDiscovery { try { if (-not (Get-Module -Name 'DscResource.Test')) { # Assumes dependencies have been resolved, so if this module is not available, run 'noop' task. if (-not (Get-Module -Name 'DscResource.Test' -ListAvailable)) { # Redirect all streams to $null, except the error stream (stream 2) & "$PSScriptRoot/../../../build.ps1" -Tasks 'noop' 3>&1 4>&1 5>&1 6>&1 > $null } # If the dependencies have not been resolved, this will throw an error. Import-Module -Name 'DscResource.Test' -Force -ErrorAction 'Stop' } } catch [System.IO.FileNotFoundException] { throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks noop" first.' } } BeforeAll { $script:moduleName = '{MyModuleName}' Import-Module -Name $script:moduleName -Force -ErrorAction 'Stop' $PSDefaultParameterValues['InModuleScope:ModuleName'] = $script:moduleName $PSDefaultParameterValues['Mock:ModuleName'] = $script:moduleName $PSDefaultParameterValues['Should:ModuleName'] = $script:moduleName } AfterAll { $PSDefaultParameterValues.Remove('InModuleScope:ModuleName') $PSDefaultParameterValues.Remove('Mock:ModuleNam...
Files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
{**/*.ps1,**/*.psm1,**/*.psd1}
⚙️ CodeRabbit configuration file
{**/*.ps1,**/*.psm1,**/*.psd1}: # PowerShell GuidelinesNaming
- Use descriptive names (3+ characters, no abbreviations)
- Functions: PascalCase with Verb-Noun format using approved verbs
- Parameters: PascalCase
- Variables: camelCase
- Keywords: lower-case
- Classes: PascalCase
- Include scope for script/global/environment variables:
$script:,$global:,$env:File naming
- Class files:
###.ClassName.ps1format (e.g.001.SqlReason.ps1,004.StartupParameters.ps1)Formatting
Indentation & Spacing
- Use 4 spaces (no tabs)
- One space around operators:
$a = 1 + 2- One space between type and variable:
[String] $name- One space between keyword and parenthesis:
if ($condition)- No spaces on empty lines
- Try to limit lines to 120 characters
Braces
- Newline before opening brace (except variable assignments)
- One newline after opening brace
- Two newlines after closing brace (one if followed by another brace or continuation)
Quotes
- Use single quotes unless variable expansion is needed:
'text'vs"text $variable"Arrays
- Single line:
@('one', 'two', 'three')- Multi-line: each element on separate line with proper indentation
- Do not use the unary comma operator (
,) in return statements to force
an arrayHashtables
- Empty:
@{}- Each property on separate line with proper indentation
- Properties: Use PascalCase
Comments
- Single line:
# Comment(capitalized, on own line)- Multi-line:
<# Comment #>format (opening and closing brackets on own line), and indent text- No commented-out code
Comment-based help
- Always add comment-based help to all functions and scripts
- Comment-based help: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, EXAMPLE sections before function/class
- Comment-based help indentation: keywords 4 spaces, text 8 spaces
- Include examples for all parameter sets and combinations
- INPUTS: List each pipeline‑accepted type (one per line) with a 1‑line description...
Files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
**/*.[Tt]ests.ps1
⚙️ CodeRabbit configuration file
**/*.[Tt]ests.ps1: # Tests GuidelinesCore Requirements
- All public commands, private functions and classes must have unit tests
- All public commands and class-based resources must have integration tests
- Use Pester v5 syntax only
- Test code only inside
Describeblocks- Assertions only in
Itblocks- Never test verbose messages, debug messages or parameter binding behavior
- Pass all mandatory parameters to avoid prompts
Requirements
- Inside
Itblocks, assign unused return objects to$null(unless part of pipeline)- Tested entity must be called from within the
Itblocks- Keep results and assertions in same
Itblock- Avoid try-catch-finally for cleanup, use
AfterAllorAfterEach- Avoid unnecessary remove/recreate cycles
Naming
- One
Describeblock per file matching the tested entity name
Contextdescriptions start with 'When'
Itdescriptions start with 'Should', must not contain 'when'- Mock variables prefix: 'mock'
Structure & Scope
- Public commands: Never use
InModuleScope(unless retrieving localized strings)- Private functions/class resources: Always use
InModuleScope- Each class method = separate
Contextblock- Each scenario = separate
Contextblock- Use nested
Contextblocks for complex scenarios- Mocking in
BeforeAll(BeforeEachonly when required)- Setup/teardown in
BeforeAll,BeforeEach/AfterAll,AfterEachclose to usageSyntax Rules
- PascalCase:
Describe,Context,It,Should,BeforeAll,BeforeEach,AfterAll,AfterEach- Use
-BeTrue/-BeFalsenever-Be $true/-Be $false- Never use
Assert-MockCalled, useShould -Invokeinstead- No
Should -Not -Throw- invoke commands directly- Never add an empty
-MockWithblock- Omit
-MockWithwhen returning$null- Set
$PSDefaultParameterValuesforMock:ModuleName,Should:ModuleName,InModuleScope:ModuleName- Omit
-ModuleNameparameter on Pester commands- Never use
Mockinside `InModuleSc...
Files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
source/**/*.ps1
⚙️ CodeRabbit configuration file
source/**/*.ps1: # Localization GuidelinesRequirements
- Localize all Write-Debug, Write-Verbose, Write-Error, Write-Warning and $PSCmdlet.ThrowTerminatingError() messages
- Use localized string keys, not hardcoded strings
- Assume
$script:localizedDatais availableString Files
- Commands/functions:
source/en-US/{MyModuleName}.strings.psd1- Class resources:
source/en-US/{ResourceClassName}.strings.psd1Key Naming Patterns
- Format:
Verb_FunctionName_Action(underscore separators), e.g.Get_Database_ConnectingToDatabaseString Format
ConvertFrom-StringData @' KeyName = Message with {0} placeholder. (PREFIX0001) '@String IDs
- Format:
(PREFIX####)- PREFIX: First letter of each word in class or function name (SqlSetup → SS, Get-SqlDscDatabase → GSDD)
- Number: Sequential from 0001
Usage
Write-Verbose -Message ($script:localizedData.KeyName -f $value1)
Files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
🧠 Learnings (47)
📓 Common learnings
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Use Pester v5 syntax only
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : Include the exact Pester setup block before Describe: SuppressMessage attribute with param (); BeforeDiscovery to ensure DscResource.Test is available (fallback to build.ps1 -Tasks 'noop') and Import-Module; BeforeAll to set $script:moduleName, import the module, and set PSDefaultParameterValues for InModuleScope/Mock/Should; AfterAll to remove those defaults and unload the tested module
Learnt from: dan-hughes
PR: dsccommunity/UpdateServicesDsc#85
File: source/en-US/UpdateServicesDsc.strings.psd1:1-2
Timestamp: 2025-10-04T21:33:23.022Z
Learning: In UpdateServicesDsc (and similar DSC modules), the module-level localization file (source/en-US/<ModuleName>.strings.psd1) can be empty when DSC resources have their own localization files in source/DSCResources/<ResourceName>/en-US/DSC_<ResourceName>.strings.psd1. Automated tests verify localization completeness for resources. Don't flag empty module-level localization files as issues when resources have separate localization.
Learnt from: dan-hughes
PR: dsccommunity/ActiveDirectoryDsc#741
File: azure-pipelines.yml:104-104
Timestamp: 2025-08-10T15:11:52.897Z
Learning: In the ActiveDirectoryDsc project, HQRM (High Quality Resource Module) tests must run in PowerShell 5 (Windows PowerShell) using `pwsh: false` in the Azure Pipelines configuration, while unit tests can run in PowerShell 7 (PowerShell Core) with `pwsh: true`. This differentiation is intentional due to HQRM's specific requirements and dependencies on Windows PowerShell.
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2150
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:35-35
Timestamp: 2025-08-28T15:44:12.628Z
Learning: The repository uses RequiredModules.psd1 to specify Pester version requirements with RequiredVersion = 'latest', which ensures compatibility with Should -Invoke syntax (requires Pester 5.4+).
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-09-16T16:35:31.909Z
Learning: Applies to tests/Unit/{Classes,Public,Private}/*.Tests.ps1 : Add unit tests for all commands, functions, and resources
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2150
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:35-35
Timestamp: 2025-08-28T15:44:12.628Z
Learning: The SqlServerDsc repository uses RequiredModules.psd1 to specify Pester with Version = 'latest' and AllowPrerelease = $true, ensuring the latest Pester version (well beyond 5.4) is available, which supports Should -Invoke syntax and other modern Pester features.
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2300
File: tests/Unit/DSC_SqlAGDatabase.Tests.ps1:22-22
Timestamp: 2025-10-11T08:35:56.141Z
Learning: In DSC Community projects, when writing error messages for missing DscResource.Test module dependency in unit test files (tests/[Uu]nit/**/*.[Tt]ests.ps1), the policy is: new code should instruct users to run ".\build.ps1 -Tasks noop" for quick test environment setup; existing code using ".\build.ps1 -Tasks build" is acceptable but slower since it also builds the project. The `noop` task is preferred as it assumes the module is already built before running tests, especially when tests run in a separate process.
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Avoid unnecessary remove/recreate cycles in tests
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Use localized strings for all messages (e.g., Write-Verbose, Write-Error)
📚 Learning: 2025-09-16T16:34:44.689Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : Include the exact Pester setup block before Describe: SuppressMessage attribute with param (); BeforeDiscovery to ensure DscResource.Test is available (fallback to build.ps1 -Tasks 'noop') and Import-Module; BeforeAll to set $script:moduleName, import the module, and set PSDefaultParameterValues for InModuleScope/Mock/Should; AfterAll to remove those defaults and unload the tested module
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:35:31.909Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-09-16T16:35:31.909Z
Learning: Applies to tests/Unit/{Classes,Public,Private}/*.Tests.ps1 : Add unit tests for all commands, functions, and resources
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1 : Include the required Pester setup block (SuppressMessage param, BeforeDiscovery loading DscResource.Test, and BeforeAll importing the module)
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/Integration/Resources/*.Integration.Tests.ps1 : Place resource integration tests at tests/Integration/Resources/{ResourceName}.Integration.Tests.ps1
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:35:31.909Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-09-16T16:35:31.909Z
Learning: Applies to tests/Integration/Commands/*.Integration.Tests.ps1 : Add integration tests for all public commands (and resources)
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : All public commands and class-based resources must have integration tests
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-10T15:11:52.897Z
Learnt from: dan-hughes
PR: dsccommunity/ActiveDirectoryDsc#741
File: azure-pipelines.yml:104-104
Timestamp: 2025-08-10T15:11:52.897Z
Learning: In the ActiveDirectoryDsc project, HQRM (High Quality Resource Module) tests must run in PowerShell 5 (Windows PowerShell) using `pwsh: false` in the Azure Pipelines configuration, while unit tests can run in PowerShell 7 (PowerShell Core) with `pwsh: true`. This differentiation is intentional due to HQRM's specific requirements and dependencies on Windows PowerShell.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-11T08:18:26.062Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2300
File: tests/Unit/DSC_SqlAGDatabase.Tests.ps1:22-22
Timestamp: 2025-10-11T08:18:26.062Z
Learning: In unit test files (tests/[Uu]nit/**/*.[Tt]ests.ps1), when DscResource.Test module dependency is not found during BeforeDiscovery setup, the error message should instruct users to run ".\build.ps1 -Tasks noop" (not "build") because the noop task is designed for quick test environment setup. The build task is more extensive and unnecessary when tests run in a separate process, as the module should already be built before running tests.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:26:13.396Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-10-26T13:26:13.396Z
Learning: Applies to tests/Unit/**/*.Tests.ps1 : Unit tests must set $env:SqlServerDscCI = $true in BeforeAll and remove it in AfterAll
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-10T14:01:42.703Z
Learnt from: dan-hughes
PR: dsccommunity/UpdateServicesDsc#86
File: tests/Unit/MSFT_UpdateServicesServer.Tests.ps1:6-45
Timestamp: 2025-10-10T14:01:42.703Z
Learning: For script-based (MOF) DSC resources in UpdateServicesDsc, unit tests should use Initialize-TestEnvironment with variables $script:dscModuleName and $script:dscResourceName, and set -ResourceType 'Mof'. This differs from class-based resource tests which use the simpler $script:moduleName template without Initialize-TestEnvironment.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1 : Do not use mocking in integration tests; run against a real environment
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1 : Call commands with -Force where applicable to avoid prompting
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Use Pester v5 syntax only
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:26:13.396Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-10-26T13:26:13.396Z
Learning: Applies to tests/Integration/**/*.Tests.ps1 : Integration tests must use Connect-SqlDscDatabaseEngine with correct CI credentials to open DB sessions
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Define mocks in BeforeAll; use BeforeEach only when required
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Never use Assert-MockCalled; use Should -Invoke instead
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:26:13.397Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-10-26T13:26:13.397Z
Learning: Applies to tests/Integration/**/*.Tests.ps1 : Integration tests must call Disconnect-SqlDscDatabaseEngine after Connect-SqlDscDatabaseEngine
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Pass all mandatory parameters in tests to avoid prompts
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-16T16:34:44.689Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : Use the provided Parameter Set Validation test template to assert command ParameterSetName and full parameter list string; for multiple parameter sets, supply multiple hashtables via -ForEach
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:34:44.689Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : Use the Parameter Properties template to assert a parameter is mandatory via $parameterInfo = (Get-Command -Name 'CommandName').Parameters['ParameterName']; $parameterInfo.Attributes.Mandatory | Should -BeTrue
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:34:44.689Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : All public commands must include parameter set validation tests
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-17T10:15:48.194Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2136
File: tests/Unit/Public/Remove-SqlDscLogin.Tests.ps1:36-39
Timestamp: 2025-08-17T10:15:48.194Z
Learning: Public command unit tests guideline: Never use InModuleScope unless accessing localized strings from $script:localizedData. PSDefaultParameterValues for InModuleScope should be kept in public command tests to support localized string retrieval when necessary.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1 : Avoid using -ExpectedMessage with Should -Throw assertions
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-16T13:22:15.230Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2134
File: tests/Unit/Public/Get-SqlDscLogin.Tests.ps1:78-93
Timestamp: 2025-08-16T13:22:15.230Z
Learning: In PowerShell unit tests for parameter validation in SqlServerDsc, accessing parameter attributes directly like `$cmd.Parameters['ParameterName'].Attributes.Mandatory` works correctly because PowerShell automatically iterates through the array and returns the property values. Additional filtering to ParameterAttribute is not necessary when the parameter structure is known and controlled.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-09T19:29:36.323Z
Learnt from: johlju
PR: dsccommunity/DscResource.Test#167
File: source/Private/Test-FileContainsClassResource.ps1:44-56
Timestamp: 2025-08-09T19:29:36.323Z
Learning: In the DscResource.Test repository, DSC resource attributes are consistently written as `[DscResource(...)]` rather than using variations like `[DscResourceAttribute()]` or fully qualified names like `[Microsoft.PowerShell.DesiredStateConfiguration.DscResource()]`. The Test-FileContainsClassResource function should focus on detecting the standard `[DscResource(...)]` pattern that is actually used in the codebase.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-04T21:33:23.022Z
Learnt from: dan-hughes
PR: dsccommunity/UpdateServicesDsc#85
File: source/en-US/UpdateServicesDsc.strings.psd1:1-2
Timestamp: 2025-10-04T21:33:23.022Z
Learning: In UpdateServicesDsc (and similar DSC modules), the module-level localization file (source/en-US/<ModuleName>.strings.psd1) can be empty when DSC resources have their own localization files in source/DSCResources/<ResourceName>/en-US/DSC_<ResourceName>.strings.psd1. Automated tests verify localization completeness for resources. Don't flag empty module-level localization files as issues when resources have separate localization.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:35:31.909Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-09-16T16:35:31.909Z
Learning: Applies to **/*.ps1 : Follow PowerShell style and test guideline instructions strictly
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-03T15:27:39.511Z
Learnt from: Borgquite
PR: dsccommunity/UpdateServicesDsc#78
File: source/DSCResources/MSFT_UpdateServicesComputerTargetGroup/MSFT_UpdateServicesComputerTargetGroup.psm1:91-109
Timestamp: 2025-10-03T15:27:39.511Z
Learning: For MOF-based DSC resources in DSC Community repositories (files matching `source/DSCResources/MSFT_*/MSFT_*.psm1`), the comment-based help for `Get-TargetResource`, `Set-TargetResource`, and `Test-TargetResource` functions should NOT include `.OUTPUTS` sections, even though the general PowerShell guidelines require them. This is an established pattern in the DSC Community.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Test-TargetResource must return a boolean ($true/$false)
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-11T08:35:56.141Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2300
File: tests/Unit/DSC_SqlAGDatabase.Tests.ps1:22-22
Timestamp: 2025-10-11T08:35:56.141Z
Learning: In DSC Community projects, when writing error messages for missing DscResource.Test module dependency in unit test files (tests/[Uu]nit/**/*.[Tt]ests.ps1), the policy is: new code should instruct users to run ".\build.ps1 -Tasks noop" for quick test environment setup; existing code using ".\build.ps1 -Tasks build" is acceptable but slower since it also builds the project. The `noop` task is preferred as it assumes the module is already built before running tests, especially when tests run in a separate process.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Set-TargetResource and Test-TargetResource must have identical parameters
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Set-TargetResource must not return anything (void)
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Every MOF DSC resource module must define the functions: Get-TargetResource, Set-TargetResource, and Test-TargetResource
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Test-TargetResource: Write-Verbose message should start with "Determining the current state of..."
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Each of Get-/Set-/Test-TargetResource must include at least one Write-Verbose call
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Set-TargetResource: Write-Verbose message should start with "Setting the desired state of..."
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Get-TargetResource must return a hashtable containing all resource properties
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-28T15:44:12.628Z
Learnt from: johlju
PR: dsccommunity/SqlServerDsc#2150
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:35-35
Timestamp: 2025-08-28T15:44:12.628Z
Learning: The repository uses RequiredModules.psd1 to specify Pester version requirements with RequiredVersion = 'latest', which ensures compatibility with Should -Invoke syntax (requires Pester 5.4+).
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-12T13:20:14.850Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-class-resource.instructions.md:0-0
Timestamp: 2025-09-12T13:20:14.850Z
Learning: Applies to source/[cC]lasses/**/*.ps1 : Implement [System.Boolean] Test() that calls ([ResourceBase] $this).Test() and returns the result
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-12T13:20:14.850Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-class-resource.instructions.md:0-0
Timestamp: 2025-09-12T13:20:14.850Z
Learning: Applies to source/[cC]lasses/**/*.ps1 : Comment-based help .DESCRIPTION must include '## Requirements'
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-26T13:28:23.439Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-powershell.instructions.md:0-0
Timestamp: 2025-10-26T13:28:23.439Z
Learning: Applies to **/*.{ps1,psm1} : Comment-based help must include SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, EXAMPLE sections before function/class
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-26T13:28:23.439Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-powershell.instructions.md:0-0
Timestamp: 2025-10-26T13:28:23.439Z
Learning: Applies to **/*.{ps1,psm1} : For state-changing functions, use SupportsShouldProcess with immediate ShouldProcess checks before each change, set ConfirmImpact, follow required pattern, avoid Write-Verbose inside the block
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : For unused mandatory parameters in Set-TargetResource or Test-TargetResource, add a help comment: "Not used in <function_name>"
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-26T13:28:23.439Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-powershell.instructions.md:0-0
Timestamp: 2025-10-26T13:28:23.439Z
Learning: Applies to **/*.{ps1,psm1} : Always add comment-based help to all functions and scripts
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : All public commands, private functions and classes must have unit tests
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-12T13:20:14.850Z
Learnt from: CR
PR: dsccommunity/SqlServerDsc#0
File: .github/instructions/dsc-community-style-guidelines-class-resource.instructions.md:0-0
Timestamp: 2025-09-12T13:20:14.850Z
Learning: Applies to source/[cC]lasses/**/*.ps1 : Comment-based help .DESCRIPTION must include '## Known issues' with link text: All issues are not listed here, see [all open issues](https://github.com/{owner}/{repo}/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+{ResourceName}).
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: dsccommunity.xRemoteDesktopSessionHost (Build Package Module)
🔇 Additional comments (3)
source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1 (1)
14-21: LGTM! Function implementation is correct.All issues from the previous review have been addressed:
- Comment-based help has been added
[CmdletBinding()]and[OutputType()]attributes are present- Using
::new()instead ofNew-ObjectThe function logic correctly compares the OS version against the Windows Server 2012 baseline.
tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1 (2)
243-269: LGTM!The Set-TargetResource tests correctly mock dependencies, assign the result to
$null, and verify invocations usingShould -Invoke.
145-176: ****The test assertion at line 169 is correct. The
Get-TargetResourceimplementation explicitly returnsDatabaseSecondaryConnectionStringfrom the input parameter (not fromGet-RDConnectionBrokerHighAvailability), while all other properties are sourced from the mock output. When the mock returns$null, the properties from the mock become null/empty, butDatabaseSecondaryConnectionStringcorrectly returns the input parameter value as implemented.Likely an incorrect or invalid review comment.
        
          
                ...ules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1 (1)
23-23: Update error message to reference the 'noop' task.The error message should instruct users to run
.\build.ps1 -Tasks noop(notbuild) for quick test environment setup.Based on learnings
Apply this diff:
- throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks build" first.' + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks noop" first.'
🧹 Nitpick comments (1)
source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1 (1)
14-14: Adjust EXAMPLE section indentation to match guidelines.The text in the EXAMPLE section uses 7 spaces of indentation instead of the required 8 spaces. Per the coding guidelines, comment-based help text should be indented with 8 spaces.
Apply this diff to fix the indentation:
.EXAMPLE - Test-xRemoteDesktopSessionHostOsRequirement + Test-xRemoteDesktopSessionHostOsRequirement - Returns $true if the OS is Windows Server 2012 or later, otherwise $false. + Returns $true if the OS is Windows Server 2012 or later, otherwise $false. #>Also applies to: 16-16
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1(1 hunks)
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**
⚙️ CodeRabbit configuration file
**: # DSC Community GuidelinesTerminology
- Command: Public command
- Function: Private function
- Resource: DSC class-based resource
Build & Test Workflow Requirements
- Run PowerShell script files from repository root
- Setup build and test environment (once per
pwshsession):./build.ps1 -Tasks noop- Build project before running tests:
./build.ps1 -Tasks build- Always run tests in new
pwshsession:Invoke-Pester -Path @({test paths}) -Output DetailedFile Organization
- Public commands:
source/Public/{CommandName}.ps1- Private functions:
source/Private/{FunctionName}.ps1- Unit tests:
tests/Unit/{Classes|Public|Private}/{Name}.Tests.ps1- Integration tests:
tests/Integration/Commands/{CommandName}.Integration.Tests.ps1Requirements
- Follow instructions over existing code patterns
- Follow PowerShell style and test guideline instructions strictly
- Always update CHANGELOG.md Unreleased section
- Localize all strings using string keys; remove any orphaned string keys
- Check DscResource.Common before creating private functions
- Separate reusable logic into private functions
- DSC resources should always be created as class-based resources
- Add unit tests for all commands/functions/resources
- Add integration tests for all public commands and resources
Files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
tests/[Uu]nit/**/*.[Tt]ests.ps1
⚙️ CodeRabbit configuration file
tests/[Uu]nit/**/*.[Tt]ests.ps1: # Unit Tests Guidelines
- Test with localized strings: Use
InModuleScope -ScriptBlock { $script:localizedData.Key }- Mock files: Use
$TestDrivevariable (path to the test drive)- All public commands require parameter set validation tests
- After modifying classes, always run tests in new session (for changes to take effect)
Test Setup Requirements
Use this exact setup block before
Describe:[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification = 'Suppressing this rule because Script Analyzer does not understand Pester syntax.')] param () BeforeDiscovery { try { if (-not (Get-Module -Name 'DscResource.Test')) { # Assumes dependencies have been resolved, so if this module is not available, run 'noop' task. if (-not (Get-Module -Name 'DscResource.Test' -ListAvailable)) { # Redirect all streams to $null, except the error stream (stream 2) & "$PSScriptRoot/../../../build.ps1" -Tasks 'noop' 3>&1 4>&1 5>&1 6>&1 > $null } # If the dependencies have not been resolved, this will throw an error. Import-Module -Name 'DscResource.Test' -Force -ErrorAction 'Stop' } } catch [System.IO.FileNotFoundException] { throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -ResolveDependency -Tasks noop" first.' } } BeforeAll { $script:moduleName = '{MyModuleName}' Import-Module -Name $script:moduleName -Force -ErrorAction 'Stop' $PSDefaultParameterValues['InModuleScope:ModuleName'] = $script:moduleName $PSDefaultParameterValues['Mock:ModuleName'] = $script:moduleName $PSDefaultParameterValues['Should:ModuleName'] = $script:moduleName } AfterAll { $PSDefaultParameterValues.Remove('InModuleScope:ModuleName') $PSDefaultParameterValues.Remove('Mock:ModuleNam...
Files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
{**/*.ps1,**/*.psm1,**/*.psd1}
⚙️ CodeRabbit configuration file
{**/*.ps1,**/*.psm1,**/*.psd1}: # PowerShell GuidelinesNaming
- Use descriptive names (3+ characters, no abbreviations)
- Functions: PascalCase with Verb-Noun format using approved verbs
- Parameters: PascalCase
- Variables: camelCase
- Keywords: lower-case
- Classes: PascalCase
- Include scope for script/global/environment variables:
$script:,$global:,$env:File naming
- Class files:
###.ClassName.ps1format (e.g.001.SqlReason.ps1,004.StartupParameters.ps1)Formatting
Indentation & Spacing
- Use 4 spaces (no tabs)
- One space around operators:
$a = 1 + 2- One space between type and variable:
[String] $name- One space between keyword and parenthesis:
if ($condition)- No spaces on empty lines
- Try to limit lines to 120 characters
Braces
- Newline before opening brace (except variable assignments)
- One newline after opening brace
- Two newlines after closing brace (one if followed by another brace or continuation)
Quotes
- Use single quotes unless variable expansion is needed:
'text'vs"text $variable"Arrays
- Single line:
@('one', 'two', 'three')- Multi-line: each element on separate line with proper indentation
- Do not use the unary comma operator (
,) in return statements to force
an arrayHashtables
- Empty:
@{}- Each property on separate line with proper indentation
- Properties: Use PascalCase
Comments
- Single line:
# Comment(capitalized, on own line)- Multi-line:
<# Comment #>format (opening and closing brackets on own line), and indent text- No commented-out code
Comment-based help
- Always add comment-based help to all functions and scripts
- Comment-based help: SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, EXAMPLE sections before function/class
- Comment-based help indentation: keywords 4 spaces, text 8 spaces
- Include examples for all parameter sets and combinations
- INPUTS: List each pipeline‑accepted type (one per line) with a 1‑line description...
Files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
**/*.[Tt]ests.ps1
⚙️ CodeRabbit configuration file
**/*.[Tt]ests.ps1: # Tests GuidelinesCore Requirements
- All public commands, private functions and classes must have unit tests
- All public commands and class-based resources must have integration tests
- Use Pester v5 syntax only
- Test code only inside
Describeblocks- Assertions only in
Itblocks- Never test verbose messages, debug messages or parameter binding behavior
- Pass all mandatory parameters to avoid prompts
Requirements
- Inside
Itblocks, assign unused return objects to$null(unless part of pipeline)- Tested entity must be called from within the
Itblocks- Keep results and assertions in same
Itblock- Avoid try-catch-finally for cleanup, use
AfterAllorAfterEach- Avoid unnecessary remove/recreate cycles
Naming
- One
Describeblock per file matching the tested entity name
Contextdescriptions start with 'When'
Itdescriptions start with 'Should', must not contain 'when'- Mock variables prefix: 'mock'
Structure & Scope
- Public commands: Never use
InModuleScope(unless retrieving localized strings)- Private functions/class resources: Always use
InModuleScope- Each class method = separate
Contextblock- Each scenario = separate
Contextblock- Use nested
Contextblocks for complex scenarios- Mocking in
BeforeAll(BeforeEachonly when required)- Setup/teardown in
BeforeAll,BeforeEach/AfterAll,AfterEachclose to usageSyntax Rules
- PascalCase:
Describe,Context,It,Should,BeforeAll,BeforeEach,AfterAll,AfterEach- Use
-BeTrue/-BeFalsenever-Be $true/-Be $false- Never use
Assert-MockCalled, useShould -Invokeinstead- No
Should -Not -Throw- invoke commands directly- Never add an empty
-MockWithblock- Omit
-MockWithwhen returning$null- Set
$PSDefaultParameterValuesforMock:ModuleName,Should:ModuleName,InModuleScope:ModuleName- Omit
-ModuleNameparameter on Pester commands- Never use
Mockinside `InModuleSc...
Files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
source/**/*.ps1
⚙️ CodeRabbit configuration file
source/**/*.ps1: # Localization GuidelinesRequirements
- Localize all Write-Debug, Write-Verbose, Write-Error, Write-Warning and $PSCmdlet.ThrowTerminatingError() messages
- Use localized string keys, not hardcoded strings
- Assume
$script:localizedDatais availableString Files
- Commands/functions:
source/en-US/{MyModuleName}.strings.psd1- Class resources:
source/en-US/{ResourceClassName}.strings.psd1Key Naming Patterns
- Format:
Verb_FunctionName_Action(underscore separators), e.g.Get_Database_ConnectingToDatabaseString Format
ConvertFrom-StringData @' KeyName = Message with {0} placeholder. (PREFIX0001) '@String IDs
- Format:
(PREFIX####)- PREFIX: First letter of each word in class or function name (SqlSetup → SS, Get-SqlDscDatabase → GSDD)
- Number: Sequential from 0001
Usage
Write-Verbose -Message ($script:localizedData.KeyName -f $value1)
Files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
🧠 Learnings (59)
📓 Common learnings
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Use Pester v5 syntax only
Learnt from: dan-hughes
Repo: dsccommunity/ActiveDirectoryDsc PR: 741
File: azure-pipelines.yml:104-104
Timestamp: 2025-08-10T15:11:52.897Z
Learning: In the ActiveDirectoryDsc project, HQRM (High Quality Resource Module) tests must run in PowerShell 5 (Windows PowerShell) using `pwsh: false` in the Azure Pipelines configuration, while unit tests can run in PowerShell 7 (PowerShell Core) with `pwsh: true`. This differentiation is intentional due to HQRM's specific requirements and dependencies on Windows PowerShell.
Learnt from: dan-hughes
Repo: dsccommunity/UpdateServicesDsc PR: 85
File: source/en-US/UpdateServicesDsc.strings.psd1:1-2
Timestamp: 2025-10-04T21:33:23.022Z
Learning: In UpdateServicesDsc (and similar DSC modules), the module-level localization file (source/en-US/<ModuleName>.strings.psd1) can be empty when DSC resources have their own localization files in source/DSCResources/<ResourceName>/en-US/DSC_<ResourceName>.strings.psd1. Automated tests verify localization completeness for resources. Don't flag empty module-level localization files as issues when resources have separate localization.
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : Include the exact Pester setup block before Describe: SuppressMessage attribute with param (); BeforeDiscovery to ensure DscResource.Test is available (fallback to build.ps1 -Tasks 'noop') and Import-Module; BeforeAll to set $script:moduleName, import the module, and set PSDefaultParameterValues for InModuleScope/Mock/Should; AfterAll to remove those defaults and unload the tested module
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Use localized strings for all messages (e.g., Write-Verbose, Write-Error)
Learnt from: johlju
Repo: dsccommunity/SqlServerDsc PR: 2300
File: tests/Unit/DSC_SqlAGDatabase.Tests.ps1:22-22
Timestamp: 2025-10-11T08:35:56.141Z
Learning: In DSC Community projects, when writing error messages for missing DscResource.Test module dependency in unit test files (tests/[Uu]nit/**/*.[Tt]ests.ps1), the policy is: new code should instruct users to run ".\build.ps1 -Tasks noop" for quick test environment setup; existing code using ".\build.ps1 -Tasks build" is acceptable but slower since it also builds the project. The `noop` task is preferred as it assumes the module is already built before running tests, especially when tests run in a separate process.
Learnt from: johlju
Repo: dsccommunity/SqlServerDsc PR: 2150
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:35-35
Timestamp: 2025-08-28T15:44:12.628Z
Learning: The repository uses RequiredModules.psd1 to specify Pester version requirements with RequiredVersion = 'latest', which ensures compatibility with Should -Invoke syntax (requires Pester 5.4+).
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Import localized strings at the top of the module using Get-LocalizedData
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Avoid unnecessary remove/recreate cycles in tests
Learnt from: johlju
Repo: dsccommunity/SqlServerDsc PR: 2300
File: tests/Unit/DSC_SqlAGDatabase.Tests.ps1:22-22
Timestamp: 2025-10-11T08:18:26.062Z
Learning: In unit test files (tests/[Uu]nit/**/*.[Tt]ests.ps1), when DscResource.Test module dependency is not found during BeforeDiscovery setup, the error message should instruct users to run ".\build.ps1 -Tasks noop" (not "build") because the noop task is designed for quick test environment setup. The build task is more extensive and unnecessary when tests run in a separate process, as the module should already be built before running tests.
📚 Learning: 2025-09-16T16:34:44.689Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : Include the exact Pester setup block before Describe: SuppressMessage attribute with param (); BeforeDiscovery to ensure DscResource.Test is available (fallback to build.ps1 -Tasks 'noop') and Import-Module; BeforeAll to set $script:moduleName, import the module, and set PSDefaultParameterValues for InModuleScope/Mock/Should; AfterAll to remove those defaults and unload the tested module
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:35:31.909Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-09-16T16:35:31.909Z
Learning: Applies to tests/Unit/{Classes,Public,Private}/*.Tests.ps1 : Add unit tests for all commands, functions, and resources
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1 : Include the required Pester setup block (SuppressMessage param, BeforeDiscovery loading DscResource.Test, and BeforeAll importing the module)
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/Integration/Resources/*.Integration.Tests.ps1 : Place resource integration tests at tests/Integration/Resources/{ResourceName}.Integration.Tests.ps1
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:35:31.909Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-09-16T16:35:31.909Z
Learning: Applies to tests/Integration/Commands/*.Integration.Tests.ps1 : Add integration tests for all public commands (and resources)
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : All public commands and class-based resources must have integration tests
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to tests/Unit/Classes/*.Tests.ps1 : Place class resource unit tests under tests/Unit/Classes/{Name}.Tests.ps1
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-10T14:01:42.703Z
Learnt from: dan-hughes
Repo: dsccommunity/UpdateServicesDsc PR: 86
File: tests/Unit/MSFT_UpdateServicesServer.Tests.ps1:6-45
Timestamp: 2025-10-10T14:01:42.703Z
Learning: For script-based (MOF) DSC resources in UpdateServicesDsc, unit tests should use Initialize-TestEnvironment with variables $script:dscModuleName and $script:dscResourceName, and set -ResourceType 'Mof'. This differs from class-based resource tests which use the simpler $script:moduleName template without Initialize-TestEnvironment.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:26:13.396Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-10-26T13:26:13.396Z
Learning: Applies to tests/Unit/**/*.Tests.ps1 : Unit tests must set $env:SqlServerDscCI = $true in BeforeAll and remove it in AfterAll
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-10T15:11:52.897Z
Learnt from: dan-hughes
Repo: dsccommunity/ActiveDirectoryDsc PR: 741
File: azure-pipelines.yml:104-104
Timestamp: 2025-08-10T15:11:52.897Z
Learning: In the ActiveDirectoryDsc project, HQRM (High Quality Resource Module) tests must run in PowerShell 5 (Windows PowerShell) using `pwsh: false` in the Azure Pipelines configuration, while unit tests can run in PowerShell 7 (PowerShell Core) with `pwsh: true`. This differentiation is intentional due to HQRM's specific requirements and dependencies on Windows PowerShell.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1 : Do not use mocking in integration tests; run against a real environment
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1 : Call commands with -Force where applicable to avoid prompting
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Use Pester v5 syntax only
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:26:13.396Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-10-26T13:26:13.396Z
Learning: Applies to tests/Integration/**/*.Tests.ps1 : Integration tests must use Connect-SqlDscDatabaseEngine with correct CI credentials to open DB sessions
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Define mocks in BeforeAll; use BeforeEach only when required
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Never use Assert-MockCalled; use Should -Invoke instead
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:26:13.397Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-10-26T13:26:13.397Z
Learning: Applies to tests/Integration/**/*.Tests.ps1 : Integration tests must call Disconnect-SqlDscDatabaseEngine after Connect-SqlDscDatabaseEngine
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Pass all mandatory parameters in tests to avoid prompts
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-16T16:34:44.689Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : Use the provided Parameter Set Validation test template to assert command ParameterSetName and full parameter list string; for multiple parameter sets, supply multiple hashtables via -ForEach
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:34:44.689Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : Use the Parameter Properties template to assert a parameter is mandatory via $parameterInfo = (Get-Command -Name 'CommandName').Parameters['ParameterName']; $parameterInfo.Attributes.Mandatory | Should -BeTrue
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:34:44.689Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-unit-tests.instructions.md:0-0
Timestamp: 2025-09-16T16:34:44.689Z
Learning: Applies to tests/[Uu]nit/**/*.[Tt]ests.ps1 : All public commands must include parameter set validation tests
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-17T10:15:48.194Z
Learnt from: johlju
Repo: dsccommunity/SqlServerDsc PR: 2136
File: tests/Unit/Public/Remove-SqlDscLogin.Tests.ps1:36-39
Timestamp: 2025-08-17T10:15:48.194Z
Learning: Public command unit tests guideline: Never use InModuleScope unless accessing localized strings from $script:localizedData. PSDefaultParameterValues for InModuleScope should be kept in public command tests to support localized string retrieval when necessary.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-12T11:23:30.123Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-integration-tests.instructions.md:0-0
Timestamp: 2025-10-12T11:23:30.123Z
Learning: Applies to tests/[iI]ntegration/**/*.[iI]ntegration.[tT]ests.ps1 : Avoid using -ExpectedMessage with Should -Throw assertions
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-16T13:22:15.230Z
Learnt from: johlju
Repo: dsccommunity/SqlServerDsc PR: 2134
File: tests/Unit/Public/Get-SqlDscLogin.Tests.ps1:78-93
Timestamp: 2025-08-16T13:22:15.230Z
Learning: In PowerShell unit tests for parameter validation in SqlServerDsc, accessing parameter attributes directly like `$cmd.Parameters['ParameterName'].Attributes.Mandatory` works correctly because PowerShell automatically iterates through the array and returns the property values. Additional filtering to ParameterAttribute is not necessary when the parameter structure is known and controlled.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-09T19:29:36.323Z
Learnt from: johlju
Repo: dsccommunity/DscResource.Test PR: 167
File: source/Private/Test-FileContainsClassResource.ps1:44-56
Timestamp: 2025-08-09T19:29:36.323Z
Learning: In the DscResource.Test repository, DSC resource attributes are consistently written as `[DscResource(...)]` rather than using variations like `[DscResourceAttribute()]` or fully qualified names like `[Microsoft.PowerShell.DesiredStateConfiguration.DscResource()]`. The Test-FileContainsClassResource function should focus on detecting the standard `[DscResource(...)]` pattern that is actually used in the codebase.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-04T21:33:23.022Z
Learnt from: dan-hughes
Repo: dsccommunity/UpdateServicesDsc PR: 85
File: source/en-US/UpdateServicesDsc.strings.psd1:1-2
Timestamp: 2025-10-04T21:33:23.022Z
Learning: In UpdateServicesDsc (and similar DSC modules), the module-level localization file (source/en-US/<ModuleName>.strings.psd1) can be empty when DSC resources have their own localization files in source/DSCResources/<ResourceName>/en-US/DSC_<ResourceName>.strings.psd1. Automated tests verify localization completeness for resources. Don't flag empty module-level localization files as issues when resources have separate localization.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:35:31.909Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-09-16T16:35:31.909Z
Learning: Applies to **/*.ps1 : Follow PowerShell style and test guideline instructions strictly
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-03T15:27:39.511Z
Learnt from: Borgquite
Repo: dsccommunity/UpdateServicesDsc PR: 78
File: source/DSCResources/MSFT_UpdateServicesComputerTargetGroup/MSFT_UpdateServicesComputerTargetGroup.psm1:91-109
Timestamp: 2025-10-03T15:27:39.511Z
Learning: For MOF-based DSC resources in DSC Community repositories (files matching `source/DSCResources/MSFT_*/MSFT_*.psm1`), the comment-based help for `Get-TargetResource`, `Set-TargetResource`, and `Test-TargetResource` functions should NOT include `.OUTPUTS` sections, even though the general PowerShell guidelines require them. This is an established pattern in the DSC Community.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Test-TargetResource must return a boolean ($true/$false)
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-11T08:35:56.141Z
Learnt from: johlju
Repo: dsccommunity/SqlServerDsc PR: 2300
File: tests/Unit/DSC_SqlAGDatabase.Tests.ps1:22-22
Timestamp: 2025-10-11T08:35:56.141Z
Learning: In DSC Community projects, when writing error messages for missing DscResource.Test module dependency in unit test files (tests/[Uu]nit/**/*.[Tt]ests.ps1), the policy is: new code should instruct users to run ".\build.ps1 -Tasks noop" for quick test environment setup; existing code using ".\build.ps1 -Tasks build" is acceptable but slower since it also builds the project. The `noop` task is preferred as it assumes the module is already built before running tests, especially when tests run in a separate process.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-11T08:18:26.062Z
Learnt from: johlju
Repo: dsccommunity/SqlServerDsc PR: 2300
File: tests/Unit/DSC_SqlAGDatabase.Tests.ps1:22-22
Timestamp: 2025-10-11T08:18:26.062Z
Learning: In unit test files (tests/[Uu]nit/**/*.[Tt]ests.ps1), when DscResource.Test module dependency is not found during BeforeDiscovery setup, the error message should instruct users to run ".\build.ps1 -Tasks noop" (not "build") because the noop task is designed for quick test environment setup. The build task is more extensive and unnecessary when tests run in a separate process, as the module should already be built before running tests.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:26:13.396Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/SqlServerDsc-guidelines.instructions.md:0-0
Timestamp: 2025-10-26T13:26:13.396Z
Learning: Initialize build/test environment per pwsh session using ./build.ps1 -Tasks noop
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-16T16:35:31.909Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines.instructions.md:0-0
Timestamp: 2025-09-16T16:35:31.909Z
Learning: Setup build and test environment once per pwsh session using ./build.ps1 -Tasks noop
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-30T18:18:31.528Z
Learnt from: dan-hughes
Repo: dsccommunity/ActiveDirectoryCSDsc PR: 158
File: source/Classes/020.AdcsOnlineResponder.ps1:0-0
Timestamp: 2025-08-30T18:18:31.528Z
Learning: For ADCS resources in ActiveDirectoryCSDsc, when catching exceptions from Install-Adcs* commands to determine installation state, use string matching on the exception message (e.g., `$_.Exception.ToString() -match 'OnlineResponderSetupException$'`) instead of catching specific exception types. This avoids dependency on importing types that may not be available in all environments like CI systems or DSC authoring machines.
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Do not use throw for terminating errors; instead use New-*Exception helper commands (e.g., New-InvalidDataException, New-ArgumentException, New-InvalidOperationException, New-ObjectNotFoundException, New-InvalidResultException, New-NotImplementedException)
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : Context descriptions must start with 'When'
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Test-TargetResource: Write-Verbose message should start with "Determining the current state of..."
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Set-TargetResource: Write-Verbose message should start with "Setting the desired state of..."
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Get-TargetResource: Write-Verbose message should start with "Getting the current state of..."
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Set-TargetResource and Test-TargetResource must have identical parameters
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : It descriptions must start with 'Should' and must not contain 'when'
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Set-TargetResource must not return anything (void)
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Every MOF DSC resource module must define the functions: Get-TargetResource, Set-TargetResource, and Test-TargetResource
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Each of Get-/Set-/Test-TargetResource must include at least one Write-Verbose call
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : Get-TargetResource must return a hashtable containing all resource properties
Applied to files:
- tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1
📚 Learning: 2025-08-28T15:44:12.628Z
Learnt from: johlju
Repo: dsccommunity/SqlServerDsc PR: 2150
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:35-35
Timestamp: 2025-08-28T15:44:12.628Z
Learning: The repository uses RequiredModules.psd1 to specify Pester version requirements with RequiredVersion = 'latest', which ensures compatibility with Should -Invoke syntax (requires Pester 5.4+).
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-12T13:20:14.850Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-class-resource.instructions.md:0-0
Timestamp: 2025-09-12T13:20:14.850Z
Learning: Applies to source/[cC]lasses/**/*.ps1 : Implement [System.Boolean] Test() that calls ([ResourceBase] $this).Test() and returns the result
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-12T13:20:14.850Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-class-resource.instructions.md:0-0
Timestamp: 2025-09-12T13:20:14.850Z
Learning: Applies to source/[cC]lasses/**/*.ps1 : Comment-based help .DESCRIPTION must include '## Requirements'
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-26T13:28:23.439Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-powershell.instructions.md:0-0
Timestamp: 2025-10-26T13:28:23.439Z
Learning: Applies to **/*.{ps1,psm1} : Comment-based help must include SYNOPSIS, DESCRIPTION (40+ chars), PARAMETER, EXAMPLE sections before function/class
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-26T13:28:23.439Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-powershell.instructions.md:0-0
Timestamp: 2025-10-26T13:28:23.439Z
Learning: Applies to **/*.{ps1,psm1} : For state-changing functions, use SupportsShouldProcess with immediate ShouldProcess checks before each change, set ConfirmImpact, follow required pattern, avoid Write-Verbose inside the block
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-12T13:20:57.155Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-mof-resources.instructions.md:0-0
Timestamp: 2025-09-12T13:20:57.155Z
Learning: Applies to source/DSCResources/**/*.psm1 : For unused mandatory parameters in Set-TargetResource or Test-TargetResource, add a help comment: "Not used in <function_name>"
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-26T13:28:23.439Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-powershell.instructions.md:0-0
Timestamp: 2025-10-26T13:28:23.439Z
Learning: Applies to **/*.{ps1,psm1} : Always add comment-based help to all functions and scripts
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-26T13:27:07.728Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-pester.instructions.md:0-0
Timestamp: 2025-10-26T13:27:07.728Z
Learning: Applies to **/*.[Tt]ests.ps1 : All public commands, private functions and classes must have unit tests
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-09-12T13:20:14.850Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-class-resource.instructions.md:0-0
Timestamp: 2025-09-12T13:20:14.850Z
Learning: Applies to source/[cC]lasses/**/*.ps1 : Comment-based help .DESCRIPTION must include '## Known issues' with link text: All issues are not listed here, see [all open issues](https://github.com/{owner}/{repo}/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+{ResourceName}).
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-26T13:28:23.439Z
Learnt from: CR
Repo: dsccommunity/SqlServerDsc PR: 0
File: .github/instructions/dsc-community-style-guidelines-powershell.instructions.md:0-0
Timestamp: 2025-10-26T13:28:23.439Z
Learning: Applies to **/*.{ps1,psm1} : Include examples for all parameter sets and combinations in comment-based help
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-08-16T13:15:17.108Z
Learnt from: johlju
Repo: dsccommunity/SqlServerDsc PR: 2134
File: source/Public/Get-SqlDscLogin.ps1:27-38
Timestamp: 2025-08-16T13:15:17.108Z
Learning: For PowerShell comment-based help in .OUTPUTS sections: Each distinct type that can be returned should have its own .OUTPUTS entry, even if the implementation technically always returns an array. This follows official PowerShell documentation standards and helps users understand what to expect in different usage scenarios.
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-08-16T13:15:17.108Z
Learnt from: johlju
Repo: dsccommunity/SqlServerDsc PR: 2134
File: source/Public/Get-SqlDscLogin.ps1:27-38
Timestamp: 2025-08-16T13:15:17.108Z
Learning: For PowerShell comment-based help .OUTPUTS sections: Each distinct return type should have its own .OUTPUTS entry with a description of when that type is returned, even if the underlying implementation uses array casting. This follows official PowerShell documentation standards where you list each return type on its own line under .OUTPUTS with clear descriptions of the conditions for each type.
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
📚 Learning: 2025-10-03T15:27:24.417Z
Learnt from: Borgquite
Repo: dsccommunity/UpdateServicesDsc PR: 78
File: source/DSCResources/MSFT_UpdateServicesComputerTargetGroup/MSFT_UpdateServicesComputerTargetGroup.psm1:9-22
Timestamp: 2025-10-03T15:27:24.417Z
Learning: In the UpdateServicesDsc repository, MOF-based DSC resources follow a minimal comment-based help convention that includes only .SYNOPSIS and .PARAMETER sections. The .DESCRIPTION, .INPUTS, and .OUTPUTS sections are intentionally omitted, even though functions have [OutputType()] attributes. This is consistent across all existing DSC resources: MSFT_UpdateServicesServer, MSFT_UpdateServicesCleanup, and MSFT_UpdateServicesApprovalRule.
Applied to files:
- source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1
🔇 Additional comments (2)
source/Modules/xRemoteDesktopSessionHost.Common/Public/Test-xRemoteDesktopSessionHostOsRequirement.ps1 (1)
19-26: LGTM! Function implementation is correct and addresses all previous feedback.The function properly implements the OS requirement check with all required elements:
- Complete comment-based help with SYNOPSIS, DESCRIPTION, OUTPUTS, and EXAMPLE sections
[CmdletBinding()]and[OutputType([System.Boolean])]attributes- Uses
[System.Version]::new()static method instead ofNew-Object- Returns a consistent boolean type matching the declared output type
The logic correctly verifies that the OS version is at least Windows Server 2012 (6.2.9200.0).
tests/Unit/MSFT_xRDConnectionBrokerHAMode.Tests.ps1 (1)
1-269: LGTM! Well-structured Pester 5 migration.The test file correctly:
- Uses the MOF resource testing pattern with
Initialize-TestEnvironmentandRestore-TestEnvironment- Follows Pester 5 syntax with
Should -Invoke, proper Context/It descriptions, and BeforeAll/AfterAll blocks- Tests all three required MOF resource functions with appropriate scenarios
- Uses
InModuleScopecorrectly for MOF resource testing- Sets
PSDefaultParameterValuesfor Pester commandsThe migration to Pester 5 is complete and well-executed.
| @raandree, would you be able to review please? Focus on the DSC resource changes specifically, some of it just wasn't compatible with Pester 5 and other parts look to have been written before some of the DSC helper functions existed. I am building a lab to test this against before a release can be made. | 
Pull Request (PR) description
Migrate tests to Pester 5.
This Pull Request (PR) fixes the following issues
Fixes Migrate tests to Pester 5 #119
Closes xRDSessionDeployment can now remove servers, improved test function #124
Task list
Entry should say what was changed and how that affects users (if applicable), and
reference the issue being resolved (if applicable).
help.
This change is