Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
<value>Directory {0} cannot be removed because it is not empty.</value>
</data>
<data name="UnknownType" xml:space="preserve">
<value>The type is not a known type for the file system. Only "file","directory" or "symboliclink" can be specified.</value>
<value>The type is not a known type for the file system. Only "file", "directory", "symboliclink", "junction", or "hardlink" can be specified.</value>
</data>
<data name="PathOutSideBasePath" xml:space="preserve">
<value>Cannot process the path because the specified path refers to an item that is outside the basePath.</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" {
$newFile.Name | Should -BeExactly $newTestFile
}

It "New-Item reports all supported file system item types for an unknown item type" {
$errorRecord = {
New-Item -Path (Join-Path $TestDrive "unknown-type") -ItemType UnknownType -ErrorAction Stop
} | Should -Throw -PassThru

$errorRecord.FullyQualifiedErrorId | Should -BeExactly "Argument,Microsoft.PowerShell.Commands.NewItemCommand"
foreach ($itemType in '"file"', '"directory"', '"symboliclink"', '"junction"', '"hardlink"') {
$errorRecord.Exception.Message | Should -Match ([regex]::Escape($itemType))
}
}

It "Verify Remove-Item for directory" {
$existsBefore = Test-Path $testDir
Remove-Item -Path $testDir -Recurse -Force
Expand Down