mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
14 lines
602 B
PowerShell
14 lines
602 B
PowerShell
# Copyright (c) Microsoft Corporation.
|
|
# Licensed under the MIT License.
|
|
Describe "Credential tests" -Tags "CI" {
|
|
It "Explicit cast for an empty credential returns null" {
|
|
# We should explicitly check that the expression returns $null
|
|
[PSCredential]::Empty.GetNetworkCredential() | Should -BeNullOrEmpty
|
|
}
|
|
|
|
It "Explicit credential cast with string produces an exception message without value" {
|
|
$ex = { [pscredential]"1234" } | Should -Throw -ErrorId "ConvertToFinalInvalidCastException" -PassThru
|
|
$ex.Exception.Message | Should -Not -Match "1234"
|
|
}
|
|
}
|