Added testcase for validating invalid filepath scenario. (#1749)

This commit is contained in:
charub
2016-10-05 16:18:50 -07:00
committed by Dongbo Wang
parent 6526968947
commit d2feb51132
@@ -96,4 +96,12 @@ Describe "Start-Transcript, Stop-Transcript tests" -tags "CI" {
$expectedError = "CannotStartTranscription,Microsoft.PowerShell.Commands.StartTranscriptCommand"
ValidateTranscription -scriptToExecute $script -outputFilePath $null -expectedError $expectedError
}
It "Should return an error if file path is invalid" {
$fileName = (Get-Random).ToString()
$inputPath = join-path $TestDrive $fileName
$null = New-Item -Path $inputPath -ItemType File -Force -ErrorAction SilentlyContinue
$script = "Start-Transcript -OutputDirectory $inputPath"
$expectedError = "CannotStartTranscription,Microsoft.PowerShell.Commands.StartTranscriptCommand"
ValidateTranscription -scriptToExecute $script -outputFilePath $null -expectedError $expectedError
}
}