Skip to content

Commit 0bfee35

Browse files
bmanikmadityapatwardhan
authored andcommitted
Add an additional acceptance test for the PowerShellGet module (PowerShell#4531)
* Add an additional acceptance test for the PowerShellGet module * Removed 'BVT' tag
1 parent 384a9fe commit 0bfee35

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function Initialize
9090

9191
function Remove-InstalledModules
9292
{
93-
Get-InstalledModule -Name $ContosoServer -AllVersions -ErrorAction SilentlyContinue | Uninstall-Module -Force
93+
Get-InstalledModule -Name $ContosoServer -AllVersions -ErrorAction SilentlyContinue | PowerShellGet\Uninstall-Module -Force
9494
}
9595

9696
Describe "PowerShellGet - Module tests" -tags "Feature" {
@@ -226,6 +226,38 @@ Describe "PowerShellGet - Script tests (Admin)" -tags @('Feature', 'RequireAdmin
226226
}
227227
}
228228

229+
Describe 'PowerShellGet Type tests' -tags @('CI') {
230+
BeforeAll {
231+
Import-Module PowerShellGet -Force
232+
}
233+
234+
It 'Ensure PowerShellGet Types are available' {
235+
$PowerShellGetNamespace = 'Microsoft.PowerShell.Commands.PowerShellGet'
236+
$PowerShellGetTypeDetails = @{
237+
InternalWebProxy = @('GetProxy', 'IsBypassed')
238+
}
239+
240+
if((IsWindows)) {
241+
$PowerShellGetTypeDetails['CERT_CHAIN_POLICY_PARA'] = @('cbSize','dwFlags','pvExtraPolicyPara')
242+
$PowerShellGetTypeDetails['CERT_CHAIN_POLICY_STATUS'] = @('cbSize','dwError','lChainIndex','lElementIndex','pvExtraPolicyStatus')
243+
$PowerShellGetTypeDetails['InternalSafeHandleZeroOrMinusOneIsInvalid'] = @('IsInvalid')
244+
$PowerShellGetTypeDetails['InternalSafeX509ChainHandle'] = @('CertFreeCertificateChain','ReleaseHandle','InvalidHandle')
245+
$PowerShellGetTypeDetails['Win32Helpers'] = @('CertVerifyCertificateChainPolicy', 'CertDuplicateCertificateChain', 'IsMicrosoftCertificate')
246+
}
247+
248+
if('Microsoft.PowerShell.Telemetry.Internal.TelemetryAPI' -as [Type]) {
249+
$PowerShellGetTypeDetails['Telemetry'] = @('TraceMessageArtifactsNotFound', 'TraceMessageNonPSGalleryRegistration')
250+
}
251+
252+
$PowerShellGetTypeDetails.GetEnumerator() | ForEach-Object {
253+
$ClassName = $_.Name
254+
$Type = "$PowerShellGetNamespace.$ClassName" -as [Type]
255+
$Type | Select-Object -ExpandProperty Name | Should Be $ClassName
256+
$_.Value | ForEach-Object { $Type.DeclaredMembers.Name -contains $_ | Should Be $true }
257+
}
258+
}
259+
}
260+
229261
if($RegisteredINTRepo)
230262
{
231263
Get-PSRepository -Name $RepositoryName -ErrorAction SilentlyContinue | Unregister-PSRepository

0 commit comments

Comments
 (0)