PowerShell/test/powershell/New-Event.Tests.ps1
Andrew Schwartzmeyer bbebf2f76a Reorganize tests
- Pester source code moved to `test/Pester`, deleted `ext-src`.
- Pester tests (.ps1 files) moved to `test/powershell`
- xUnit tests (.cs files) moved to `test/csharp`
- Third-party script test moved to `test/shebang`
2016-01-14 17:00:06 -08:00

24 lines
926 B
PowerShell

Describe "New-Event" {
Context "Check return type of New-Event" {
It "Should return PSEventArgs as return type of New-Event" {
(New-Event -SourceIdentifier a).GetType() | Should Be System.Management.Automation.PSEventArgs
}
}
Context "Check New-Event can register an event"{
It "Should return PesterTestMessage as the MessageData" {
(New-Event -sourceidentifier PesterTimer -sender windows.timer -messagedata "PesterTestMessage")
(Get-Event -SourceIdentifier PesterTimer).MessageData | Should Be "PesterTestMessage"
Remove-Event -sourceidentifier PesterTimer
}
It "Should return Sender as windows.timer" {
(New-Event -sourceidentifier PesterTimer -sender windows.timer -messagedata "PesterTestMessage")
(Get-Event -SourceIdentifier PesterTimer).Sender | Should be windows.timer
Remove-Event -sourceIdentifier PesterTimer
}
}
}