@@ -90,7 +90,7 @@ function Initialize |
90 | 90 |
|
91 | 91 | function Remove-InstalledModules |
92 | 92 | { |
93 | | - Get-InstalledModule -Name $ContosoServer -AllVersions -ErrorAction SilentlyContinue | Uninstall-Module -Force |
| 93 | + Get-InstalledModule -Name $ContosoServer -AllVersions -ErrorAction SilentlyContinue | PowerShellGet\Uninstall-Module -Force |
94 | 94 | } |
95 | 95 |
|
96 | 96 | Describe "PowerShellGet - Module tests" -tags "Feature" { |
@@ -226,6 +226,38 @@ Describe "PowerShellGet - Script tests (Admin)" -tags @('Feature', 'RequireAdmin |
226 | 226 | } |
227 | 227 | } |
228 | 228 |
|
| 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 | + |
229 | 261 | if($RegisteredINTRepo) |
230 | 262 | { |
231 | 263 | Get-PSRepository -Name $RepositoryName -ErrorAction SilentlyContinue | Unregister-PSRepository |
|