/
githubmirror
/
PowerShell
Обзор
Документация
Войти
/
githubmirror
/
PowerShell
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/powershell/Modules/Microsoft.PowerShell.Management/Remove-EventLog.Tests.ps1
34 строки
2 KB
xtqqczze
Use correct casing for cmdlet name and cmdlet parameter name in *.ps1 files (#12584)
07 май 2020, 15:00
Не верифицирован
07 май 2020, 15:00
f438220
Код
Авторство
О чём код?
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. Describe "New-EventLog cmdlet tests" -Tags @('CI', 'RequireAdminOnWindows') { BeforeAll { $defaultParamValues = $PSDefaultParameterValues.Clone() $IsNotSkipped = ($IsWindows -and !$IsCoreCLR) $PSDefaultParameterValues["it:skip"] = !$IsNotSkipped } AfterAll { $global:PSDefaultParameterValues = $defaultParamValues } BeforeEach { if ($IsNotSkipped) { Remove-EventLog -LogName TestLog -ErrorAction Ignore {New-EventLog -LogName TestLog -Source TestSource -ErrorAction Stop} | Should -Not -Throw {Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventId 1 -ErrorAction Stop} | Should -Not -Throw } } #CmdLet is NYI - change to -Skip:($NonWinAdmin) when implemented It "should be able to Remove-EventLog -LogName <string> -ComputerName <string>" -Pending:($true) { { Remove-EventLog -LogName TestLog -ComputerName $env:COMPUTERNAME -ErrorAction Stop } | Should -Not -Throw { Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventId 1 -ErrorAction Stop } | Should -Throw -ErrorId "Microsoft.PowerShell.Commands.WriteEventLogCommand" { Get-EventLog -LogName TestLog -ErrorAction Stop } | Should -Throw -ErrorId "System.InvalidOperationException,Microsoft.PowerShell.Commands.GetEventLogCommand" } #CmdLet is NYI - change to -Skip:($NonWinAdmin) when implemented It "should be able to Remove-EventLog -Source <string> -ComputerName <string>" -Pending:($true) { {Remove-EventLog -Source TestSource -ComputerName $env:COMPUTERNAME -ErrorAction Stop} | Should -Not -Throw { Write-EventLog -LogName TestLog -Source TestSource -Message "Test" -EventId 1 -ErrorAction Stop } | Should -Throw -ErrorId "Microsoft.PowerShell.Commands.WriteEventLogCommand" { Get-EventLog -LogName TestLog -ErrorAction Stop; } | Should -Throw -ErrorId "System.InvalidOperationException,Microsoft.PowerShell.Commands.GetEventLogCommand" } }