Skip to content

Commit 674d131

Browse files
Module exports test
1 parent e14974f commit 674d131

3 files changed

Lines changed: 75 additions & 10 deletions

File tree

.github/workflows/autobuild.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,6 @@ jobs:
102102
use-actions-summary: true
103103
badge-title: Unit Tests
104104

105-
- name: Generate Pester Test Report
106-
uses: dorny/test-reporter@v2
107-
if: ${{ !cancelled() }}
108-
with:
109-
name: Pester
110-
reporter: dotnet-nunit
111-
path: TestResults/*.xml
112-
use-actions-summary: true
113-
badge-title: Pester Tests
114-
115105
- name: Get PowerShell Module Version
116106
shell: pwsh
117107
id: get-module-version

Documentation/CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@
55

66
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
77

8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Instructions and prompts for GitHub Copilot.
13+
14+
### Changed
15+
16+
- A new code signing certificate has been obtained from [DigiCert](https://www.digicert.com/).
17+
- Merged the `*.psm1` script bootstrapper of the binary PowerShell module into the `*.psd1` module manifest.
18+
- Improved the structure of the `DSInternals.Replication` NuGet package,
19+
which now includes assemblies for all processor architectures and the Visual C++ runtime.
20+
21+
### Fixed
22+
23+
- Improved generation of NGC keys stored in the `msDS-KeyCredentialLink` AD attribute
24+
to pass new validation constraints introduced in January 2026 Windows updates.
25+
26+
### Removed
27+
28+
- PowerShell cmdlets and all code related to the [decommissioned Azure AD Graph API](https://learn.microsoft.com/en-us/graph/migrate-azure-ad-graph-overview)
29+
have been removed.
30+
831
## [6.2] - 2025-12-05
932

1033
> [!WARNING]

Src/DSInternals.PowerShell/Tests/Integration.Tests.ps1

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,58 @@ Describe 'DSInternals PowerShell Module' {
6868
}
6969
}
7070

71+
Context 'Module Members' {
72+
BeforeDiscovery {
73+
[string] $assemblyRelativePath = if ($PSEdition -eq 'Core') { 'net8.0-windows\DSInternals.PowerShell.dll' } else { 'net48\DSInternals.PowerShell.dll' }
74+
[string] $assemblyPath = Join-Path -Path $modulePath -ChildPath $assemblyRelativePath
75+
[System.Reflection.Assembly] $assembly = [System.Reflection.Assembly]::LoadFrom($assemblyPath)
76+
77+
[type] $cmdletAttributeType = [System.Management.Automation.CmdletAttribute]
78+
[type] $aliasAttributeType = [System.Management.Automation.AliasAttribute]
79+
80+
# Deprecated or not yet implemented cmdlets
81+
[string[]] $excludedCmdlets = @('Add-ADDBSidHistory', 'Get-ADDBIndex', 'Restore-ADDBAttribute')
82+
83+
# Get all cmdlets defined in the assembly using reflection
84+
[hashtable[]] $moduleCmdlets = $assembly.GetTypes() |
85+
Where-Object IsClass -eq $true |
86+
Where-Object IsAbstract -eq $false |
87+
Where-Object { $PSItem.GetCustomAttributes($cmdletAttributeType, $false).Count -gt 0 } |
88+
ForEach-Object { $PSItem.GetCustomAttributes($cmdletAttributeType, $false)[0] } |
89+
ForEach-Object { '{0}-{1}' -f $PSItem.VerbName, $PSItem.NounName } |
90+
Where-Object { $PSItem -notin $excludedCmdlets } |
91+
Sort-Object -Unique |
92+
ForEach-Object { @{ Cmdlet = $PSItem } }
93+
94+
# Get all aliases defined in the assembly using reflection
95+
[hashtable[]] $moduleAliases = $assembly.GetTypes() |
96+
Where-Object IsClass -eq $true |
97+
Where-Object IsAbstract -eq $false |
98+
Where-Object { $PSItem.GetCustomAttributes($aliasAttributeType, $false).Count -gt 0 } |
99+
ForEach-Object { $PSItem.GetCustomAttributes($aliasAttributeType, $false) } |
100+
ForEach-Object -MemberName AliasNames |
101+
Sort-Object -Unique |
102+
ForEach-Object { @{ Alias = $PSItem } }
103+
}
104+
105+
BeforeAll {
106+
# Load the module manifest
107+
[System.Management.Automation.PSModuleInfo] $manifest = Test-ModuleManifest -Path $moduleManifestPath -ErrorAction Stop
108+
}
109+
110+
It 'exports cmdlet <Cmdlet>' -TestCases $moduleCmdlets -Test {
111+
param([string] $Cmdlet)
112+
113+
$manifest.ExportedCmdlets.ContainsKey($Cmdlet) | Should -BeTrue
114+
}
115+
116+
It 'exports alias <Alias>' -TestCases $moduleAliases -Test {
117+
param([string] $Alias)
118+
119+
$manifest.ExportedAliases.ContainsKey($Alias) | Should -BeTrue
120+
}
121+
}
122+
71123
Context 'File Structure' {
72124
It 'contains MAML help' {
73125
Join-Path -Path $modulePath -ChildPath 'en-US\DSInternals.PowerShell.dll-Help.xml' | Should -Exist

0 commit comments

Comments
 (0)