2020-03-24 19:08:37 +01:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
2018-02-13 18:23:53 +01:00
|
|
|
# Licensed under the MIT License.
|
2017-09-30 01:28:15 +02:00
|
|
|
Describe "ProviderIntrinsics Tests" -tags "CI" {
|
|
|
|
BeforeAll {
|
2020-05-07 14:00:30 +02:00
|
|
|
Setup -d TestDir
|
2017-09-30 01:28:15 +02:00
|
|
|
}
|
|
|
|
It 'If a childitem exists, HasChild method returns $true' {
|
2018-03-29 06:08:23 +02:00
|
|
|
$ExecutionContext.InvokeProvider.ChildItem.HasChild("$TESTDRIVE") | Should -BeTrue
|
2017-09-30 01:28:15 +02:00
|
|
|
}
|
|
|
|
It 'If a childitem does not exist, HasChild method returns $false' {
|
2018-03-29 06:08:23 +02:00
|
|
|
$ExecutionContext.InvokeProvider.ChildItem.HasChild("$TESTDRIVE/TestDir") | Should -BeFalse
|
2017-09-30 01:28:15 +02:00
|
|
|
}
|
|
|
|
It 'If the path does not exist, HasChild throws an exception' {
|
2018-03-29 06:08:23 +02:00
|
|
|
{ $ExecutionContext.InvokeProvider.ChildItem.HasChild("TESTDRIVE/ThisDirectoryDoesNotExist") } |
|
|
|
|
Should -Throw -ErrorId 'ItemNotFoundException'
|
2017-09-30 01:28:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|