From d2feb5113266e5076416aa3199a4bc9f64c6dace Mon Sep 17 00:00:00 2001 From: charub Date: Mon, 3 Oct 2016 10:35:17 -0700 Subject: [PATCH] Added testcase for validating invalid filepath scenario. (#1749) --- .../Microsoft.Powershell.Host/Start-Transcript.Tests.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/powershell/Modules/Microsoft.Powershell.Host/Start-Transcript.Tests.ps1 b/test/powershell/Modules/Microsoft.Powershell.Host/Start-Transcript.Tests.ps1 index 09afbd705c..1ae0286deb 100644 --- a/test/powershell/Modules/Microsoft.Powershell.Host/Start-Transcript.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.Powershell.Host/Start-Transcript.Tests.ps1 @@ -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 + } } \ No newline at end of file