GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix formatting Clear-EventLog.Tests.ps1 (#6594) · PowerShell/PowerShell@a3e8929

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/powershell/Modules/Microsoft.PowerShell.Management
    • Clear-EventLog.Tests.ps1
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/powershell/Modules/Microsoft.PowerShell.Management/Clear-EventLog.Tests.ps1‎

Copy file name to clipboardExpand all lines: test/powershell/Modules/Microsoft.PowerShell.Management/Clear-EventLog.Tests.ps1
+14-12Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,22 @@ Describe "Clear-EventLog cmdlet tests" -Tags @('CI', 'RequireAdminOnWindows') {
1313

1414
It "should be able to Clear-EventLog" -Pending:($True) {
1515
Remove-EventLog -LogName TestLog -ea Ignore
16-
{New-EventLog -LogName TestLog -Source TestSource -ErrorAction Stop} | Should -Not -Throw
17-
{Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 1 -ErrorAction Stop } | Should -Not -Throw
18-
{$result=Get-EventLog -LogName TestLog} | Should -Not -Throw
19-
($result.Count) | Should -Be 1
20-
{Clear-EventLog -LogName TestLog} | Should -Not -Throw
21-
$result=Get-EventLog -LogName TestLog -ea Ignore
22-
($result.Count) | Should -Be 0
23-
{Remove-EventLog -LogName TestLog -ErrorAction Stop} | Should -Not -Throw
24-
}
25-
It "should throw 'The Log name 'MissingTestLog' does not exist' when asked to clear a log that does not exist" -Pending:($True) {
26-
Remove-EventLog -LogName MissingTestLog -ea Ignore
27-
{ Clear-EventLog -LogName MissingTestLog -ErrorAction Stop } | Should -Throw -ErrorId "Microsoft.PowerShell.Commands.ClearEventLogCommand"
16+
{ New-EventLog -LogName TestLog -Source TestSource -ErrorAction Stop } | Should -Not -Throw
17+
{ Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventID 1 -ErrorAction Stop } | Should -Not -Throw
18+
{ Get-EventLog -LogName TestLog } | Should -Not -Throw
19+
$result = Get-EventLog -LogName TestLog
20+
$result.Count | Should -Be 1
21+
{ Clear-EventLog -LogName TestLog } | Should -Not -Throw
22+
$result = Get-EventLog -LogName TestLog -ErrorAction Ignore
23+
$result.Count | Should -Be 0
24+
{ Remove-EventLog -LogName TestLog -ErrorAction Stop } | Should -Not -Throw
2825
}
26+
2927
It "should throw 'System.InvalidOperationException' when asked to clear a log that does not exist" -Pending:($True) {
28+
{ Clear-EventLog -LogName MissingTestLog -ErrorAction Stop } | Should -Throw -ExceptionType "System.InvalidOperationException"
29+
}
30+
31+
It "should throw 'Microsoft.PowerShell.Commands.ClearEventLogCommand' ErrorId when asked to clear a log that does not exist" -Pending:($True) {
3032
{ Clear-EventLog -LogName MissingTestLog -ErrorAction Stop } | Should -Throw -ErrorId "Microsoft.PowerShell.Commands.ClearEventLogCommand"
3133
}
3234
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.