mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Update New-Alias Pester Unit Test
This commit is contained in:
committed by
JumpingYang001
parent
efc24f1976
commit
5318cecf39
@@ -1,11 +1,12 @@
|
||||
Describe "New-Alias DRT Unit Tests" -Tags DRT{
|
||||
It "New-Alias Constant should throw SessionStateException skip now as bug#777" -Skip:$true{
|
||||
It "New-Alias Constant should throw SessionStateUnauthorizedAccessException"{
|
||||
try {
|
||||
New-Alias -Name "ABCD" -Value "foo" -Option "Constant" -Force:$true
|
||||
New-Alias -Name "ABCD" -Value "foo" -Force:$true
|
||||
New-Alias -Name "ABCD" -Value "foo" -Force:$true -ErrorAction Stop
|
||||
Throw "Execution OK"
|
||||
}
|
||||
catch {
|
||||
$_.CategoryInfo| Should Match "SessionStateUnauthorizedAccessException"
|
||||
$_.FullyQualifiedErrorId | Should be "AliasNotWritable,Microsoft.PowerShell.Commands.NewAliasCommand"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user