diff --git a/test/fullclr/PowerShellGithubDev.Tests.ps1 b/test/fullclr/PowerShellGithubDev.Tests.ps1 index 9e36017357..944ee69bcf 100644 --- a/test/fullclr/PowerShellGithubDev.Tests.ps1 +++ b/test/fullclr/PowerShellGithubDev.Tests.ps1 @@ -122,6 +122,20 @@ try Remove-Module -ErrorAction SilentlyContinue CimCmdlets } } + + It 'loads Microsoft.PowerShell.Diagnostics' { + try + { + Import-Module Microsoft.PowerShell.Diagnostics -ErrorAction Stop + Get-WinEvent -LogName System -MaxEvents 1 | Should Not Be $null + [Microsoft.PowerShell.Commands.GetWinEventCommand].Assembly.Location | Should Be ( + Join-Path $env:DEVPATH Microsoft.PowerShell.Commands.Diagnostics.dll) + } + finally + { + Remove-Module -ErrorAction SilentlyContinue Microsoft.PowerShell.Diagnostics + } + } } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Diagnostics/Get-WinEvent.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Diagnostics/Get-WinEvent.Tests.ps1 new file mode 100644 index 0000000000..fc438e94b6 --- /dev/null +++ b/test/powershell/Modules/Microsoft.PowerShell.Diagnostics/Get-WinEvent.Tests.ps1 @@ -0,0 +1,7 @@ +Describe 'Get-WinEvent' { + + # Get-WinEvent works only on windows + It 'can query a System log' -Skip:(-not $IsWindows) { + Get-WinEvent -LogName System -MaxEvents 1 | Should Not Be $null + } +}