File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
test/powershell/Modules/Microsoft.PowerShell.Management Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -483,6 +483,32 @@ Describe "Validate Copy-Item Remotely" -Tags "CI" {
483
483
Copy-Item - Path $filePath - FromSession $s - Destination $destinationFolderPath
484
484
ValidateCopyItemOperationForAlternateDataStream - filePath $filePath - streamName $streamName - expectedStreamContent $streamContent
485
485
}
486
+
487
+ It " Copy file to the same directory fails." {
488
+ $filePath = CreateTestFile
489
+ { Copy-Item - Path $filePath - Destination $sourceDirectory - FromSession $s - ErrorAction Stop } | ShouldBeErrorId " System.IO.IOException,WriteException"
490
+ }
491
+
492
+ It " Copy directory with a -Destination parameter given as a file path fails." {
493
+ $filePath = CreateTestFile
494
+ $folderToCopy = GetDestinationFolderPath
495
+ { Copy-Item - Path $folderToCopy - Destination $filePath - FromSession $s - ErrorAction Stop } | ShouldBeErrorId " CopyError,Microsoft.PowerShell.Commands.CopyItemCommand"
496
+ }
497
+
498
+ It " Copy-Item parameters -FromSession and -ToSession are mutually exclusive." {
499
+ try
500
+
87F1
{
501
+ $s1 = New-PSSession - ComputerName . - ErrorAction SilentlyContinue
502
+ $s1 | Should Not BeNullOrEmpty
503
+ $filePath = CreateTestFile
504
+ $destinationFolderPath = GetDestinationFolderPath
505
+ { Copy-Item - Path $filePath - Destination $destinationFolderPath - FromSession $s - ToSession $s1 - ErrorAction Stop } | ShouldBeErrorId " InvalidInput,Microsoft.PowerShell.Commands.CopyItemCommand"
506
+ }
507
+ finally
508
+ {
509
+ Remove-PSSession - Session $s1 - ErrorAction SilentlyContinue
510
+ }
511
+ }
486
512
}
487
513
488
514
Context " Validate Copy-Item Remotely using wildcards" {
You can’t perform that action at this time.
0 commit comments