MegaBites-AI/Windows-powershell
0308
1# Copyright (c) Microsoft Corporation.2# Licensed under the MIT License.3Describe "Get-Event" -Tags "CI" {4 5 BeforeEach {6 ( New-Event -SourceIdentifier PesterTestEvent -Sender Windows.timer -MessageData "PesterTestMessage" )7 }8 9 AfterEach {10 ( Remove-Event -SourceIdentifier PesterTestEvent -ErrorAction SilentlyContinue )11 }12 13 Context "Check return type of Get-Event" {14 15 It "Should return PSEventArgs as return type of Get-Event" {16 Get-Event -SourceIdentifier PesterTestEvent | Should -BeOfType System.Management.Automation.PSEventArgs17 }18 }19 20 Context "Validate Get-Event can retrieve event" {21 22 It "Should return at least 1 event" {23 { (Get-Event).Count | Should -BeGreaterThan 0 }24 }25 26 It "Should return PesterTestMessage as the MessageData" {27 { (Get-Event -SourceIdentifier PesterTimer).MessageData | Should -BeExactly "PesterTestMessage" }28 }29 30 It "Should return Sender as Windows.timer" {31 { (Get-Event -SourceIdentifier PesterTimer).Sender | Should -Be Windows.timer }32 }33 34 }35}36 