File size: 750 Bytes
8c763fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Describe "ProviderIntrinsics Tests" -tags "CI" {
    BeforeAll {
        Setup -d TestDir
    }
    It 'If a childitem exists, HasChild method returns $true' {
        $ExecutionContext.InvokeProvider.ChildItem.HasChild("$TESTDRIVE") | Should -BeTrue
    }
    It 'If a childitem does not exist, HasChild method returns $false' {
        $ExecutionContext.InvokeProvider.ChildItem.HasChild("$TESTDRIVE/TestDir") | Should -BeFalse
    }
    It 'If the path does not exist, HasChild throws an exception' {
        { $ExecutionContext.InvokeProvider.ChildItem.HasChild("TESTDRIVE/ThisDirectoryDoesNotExist") } |
            Should -Throw -ErrorId 'ItemNotFoundException'
    }
}