Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
Remove-Event.Tests.ps141 linesDownload Raw Back to Microsoft.PowerShell.Utility
1# Copyright (c) Microsoft Corporation.2# Licensed under the MIT License.3Describe "Remove-Event" -Tags "CI" {4 5    BeforeEach {6	New-Event -SourceIdentifier PesterTimer  -Sender Windows.timer -MessageData "PesterTestMessage"7    }8 9    AfterEach {10	Remove-Event -SourceIdentifier PesterTimer -ErrorAction SilentlyContinue11    }12 13    Context "Check Remove-Event can validly remove events" {14 15	It "Should remove an event given a sourceidentifier" {16	    { Remove-Event -SourceIdentifier PesterTimer }17	    { Get-Event -ErrorAction SilentlyContinue | Should -Not FileMatchContent PesterTimer }18	}19 20	It "Should remove an event given an event identifier" {21	    { $events = Get-Event -SourceIdentifier PesterTimer }22	    { $events = $events.EventIdentifier }23	    { Remove-Event -EventIdentifier $events }24	    { $events = Get-Event -ErrorAction SilentlyContinue}25	    { $events.SourceIdentifier | Should -Not FileMatchContent "PesterTimer" }26	}27 28	It "Should be able to remove an event given a pipe from Get-Event" {29	    { Get-Event -SourceIdentifier PesterTimer | Remove-Event }30	    { Get-Event -ErrorAction SilentlyContinue | Should -Not FileMatchContent "PesterTimer" }31 32	}33 34	It "Should NOT remove an event given the whatif flag" {35	    { Remove-Event -SourceIdentifier PesterTimer -WhatIf }36	    { $events = Get-Event }37	    { $events.SourceIdentifier  | Should -FileContentMatch "PesterTimer" }38	}39    }40}41