Correct case of $ExecutionContext special variable

This commit is contained in:
xtqqczze 2020-01-13 19:33:14 +00:00
parent b700c4631b
commit d0f28128f5
3 changed files with 5 additions and 5 deletions

View file

@ -120,11 +120,11 @@ Describe 'Native UNIX globbing tests' -tags "CI" {
}
# Test ~ expansion
It 'Tilde should be replaced by the filesystem provider home directory' {
/bin/echo ~ | Should -BeExactly ($executioncontext.SessionState.Provider.Get("FileSystem").Home)
/bin/echo ~ | Should -BeExactly ($ExecutionContext.SessionState.Provider.Get("FileSystem").Home)
}
# Test ~ expansion with a path fragment (e.g. ~/foo)
It '~/foo should be replaced by the <filesystem provider home directory>/foo' {
/bin/echo ~/foo | Should -BeExactly "$($executioncontext.SessionState.Provider.Get("FileSystem").Home)/foo"
/bin/echo ~/foo | Should -BeExactly "$($ExecutionContext.SessionState.Provider.Get("FileSystem").Home)/foo"
}
It '~ should not be replaced when quoted' {
/bin/echo '~' | Should -BeExactly '~'

View file

@ -161,7 +161,7 @@ Describe "CmsMessage cmdlets thorough tests" -Tags "Feature" {
$errors = $null
$recipient = [System.Management.Automation.CmsMessageRecipient] $protectedEventLoggingCertPath
$recipient.Resolve($executionContext.SessionState, "Decryption", [ref] $errors)
$recipient.Resolve($ExecutionContext.SessionState, "Decryption", [ref] $errors)
$recipient.Certificates.Count | Should -Be 1
}

View file

@ -1860,11 +1860,11 @@ try
}
It "Removing a module should clean-up event handlers (Windows 7: #268819)" {
$oldNumberOfHandlers = $executionContext.GetType().GetProperty("Events").GetValue($executionContext, $null).Subscribers.Count
$oldNumberOfHandlers = $ExecutionContext.GetType().GetProperty("Events").GetValue($ExecutionContext, $null).Subscribers.Count
$module = Import-PSSession -Session $session -Name Get-Random -AllowClobber
Remove-Module $module -Force
$newNumberOfHandlers = $executionContext.GetType().GetProperty("Events").GetValue($executionContext, $null).Subscribers.Count
$newNumberOfHandlers = $ExecutionContext.GetType().GetProperty("Events").GetValue($ExecutionContext, $null).Subscribers.Count
## Event should be unregistered when the module is removed
$oldNumberOfHandlers | Should -Be $newNumberOfHandlers