2020-03-24 11:08:37 -07:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
2018-02-13 09:23:53 -08:00
|
|
|
# Licensed under the MIT License.
|
2016-07-25 14:01:41 -07:00
|
|
|
Describe "Get-Event" -Tags "CI" {
|
2015-11-19 06:20:50 +00:00
|
|
|
|
|
|
|
|
BeforeEach {
|
2020-05-07 13:00:30 +01:00
|
|
|
( New-Event -SourceIdentifier PesterTestEvent -Sender Windows.timer -MessageData "PesterTestMessage" )
|
2016-03-04 14:52:27 -08:00
|
|
|
}
|
2015-11-19 06:20:50 +00:00
|
|
|
|
|
|
|
|
AfterEach {
|
2016-03-04 14:52:27 -08:00
|
|
|
( Remove-Event -SourceIdentifier PesterTestEvent -ErrorAction SilentlyContinue )
|
2015-11-19 06:20:50 +00:00
|
|
|
}
|
2016-03-04 14:52:27 -08:00
|
|
|
|
2015-11-19 06:20:50 +00:00
|
|
|
Context "Check return type of Get-Event" {
|
2016-03-04 14:52:27 -08:00
|
|
|
|
|
|
|
|
It "Should return PSEventArgs as return type of Get-Event" {
|
2018-03-23 10:26:23 -07:00
|
|
|
Get-Event -SourceIdentifier PesterTestEvent | Should -BeOfType System.Management.Automation.PSEventArgs
|
2015-11-19 06:20:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Context "Validate Get-Event can retrieve event" {
|
|
|
|
|
|
|
|
|
|
It "Should return at least 1 event" {
|
2018-03-23 10:26:23 -07:00
|
|
|
{ (Get-Event).Count | Should -BeGreaterThan 0 }
|
2015-11-19 06:20:50 +00:00
|
|
|
}
|
2016-03-04 14:52:27 -08:00
|
|
|
|
2015-11-19 06:20:50 +00:00
|
|
|
It "Should return PesterTestMessage as the MessageData" {
|
2018-03-23 10:26:23 -07:00
|
|
|
{ (Get-Event -SourceIdentifier PesterTimer).MessageData | Should -BeExactly "PesterTestMessage" }
|
2015-11-19 06:20:50 +00:00
|
|
|
}
|
|
|
|
|
|
2016-03-04 14:52:27 -08:00
|
|
|
It "Should return Sender as Windows.timer" {
|
2018-03-23 10:26:23 -07:00
|
|
|
{ (Get-Event -SourceIdentifier PesterTimer).Sender | Should -Be Windows.timer }
|
2015-11-19 06:20:50 +00:00
|
|
|
}
|
2016-03-04 14:52:27 -08:00
|
|
|
|
2015-11-19 06:20:50 +00:00
|
|
|
}
|
|
|
|
|
}
|