mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 20:56:02 +00:00
Based on standard practices, we need to have a copyright and license notice at the top of each source file. Removed existing copyrights and updated/added copyright notices for .h, .cpp, .cs, .ps1, and .psm1 files. Updated module manifests for consistency to have Author = "PowerShell" and Company = "Microsoft Corporation". Removed multiple line breaks. Separate PR coming to update contribution document for new source files: #6140 Manually reviewed each change. Fix #6073
41 lines
1.4 KiB
PowerShell
41 lines
1.4 KiB
PowerShell
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
Describe "Remove-Event" -Tags "CI" {
|
|
|
|
BeforeEach {
|
|
New-Event -sourceidentifier PesterTimer -sender Windows.timer -messagedata "PesterTestMessage"
|
|
}
|
|
|
|
AfterEach {
|
|
Remove-Event -sourceidentifier PesterTimer -ErrorAction SilentlyContinue
|
|
}
|
|
|
|
Context "Check Remove-Event can validly remove events" {
|
|
|
|
It "Should remove an event given a sourceidentifier" {
|
|
{ Remove-Event -sourceidentifier PesterTimer }
|
|
{ Get-Event -ErrorAction SilentlyContinue | Should Not FileMatchContent PesterTimer }
|
|
}
|
|
|
|
It "Should remove an event given an event identifier" {
|
|
{ $events = Get-Event -sourceidentifier PesterTimer }
|
|
{ $events = $events.EventIdentifier }
|
|
{ Remove-Event -EventIdentifier $events }
|
|
{ $events = Get-Event -ErrorAction SilentlyContinue}
|
|
{ $events.SourceIdentifier | Should Not FileMatchContent "PesterTimer" }
|
|
}
|
|
|
|
It "Should be able to remove an event given a pipe from Get-Event" {
|
|
{ Get-Event -sourceidentifier PesterTimer | Remove-Event }
|
|
{ Get-Event -ErrorAction SilentlyContinue | Should Not FileMatchContent "PesterTimer" }
|
|
|
|
}
|
|
|
|
It "Should NOT remove an event given the whatif flag" {
|
|
{ Remove-Event -sourceidentifier PesterTimer -whatif }
|
|
{ $events = Get-Event }
|
|
{ $events.SourceIdentifier | Should FileContentMatch "PesterTimer" }
|
|
}
|
|
}
|
|
}
|