File size: 602 Bytes
8c763fb
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 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"
    }
}