diff --git a/test/powershell/Write-Debug.Tests.ps1 b/test/powershell/Write-Debug.Tests.ps1 new file mode 100644 index 000000000..2f60c5bba --- /dev/null +++ b/test/powershell/Write-Debug.Tests.ps1 @@ -0,0 +1,23 @@ +Describe "Write-Debug DRT Unit Tests" -Tags DRT{ + function unittest-writedebugline + { + Write-Host "" + Write-Host "foo" + Write-Host "hello" -ForegroundColor Black -BackgroundColor Cyan + Write-Debug "this is a test" + } + + It "Write-Debug Test" { + $o = "this is a test" + { Write-Debug $o } | Should Not Throw + } + + It "Write-Debug Test2" { + { $debugpreference='continue'; Write-Debug 'hello' } | Should Not Throw + $debugpreference ='SilentlyContinue' + } + + It "Write-Debug Test3" { + { unittest-writedebugline } | Should Not Throw + } +} \ No newline at end of file diff --git a/test/powershell/Write-Error.Tests.ps1 b/test/powershell/Write-Error.Tests.ps1 index c951b7706..57fcc7e8f 100644 --- a/test/powershell/Write-Error.Tests.ps1 +++ b/test/powershell/Write-Error.Tests.ps1 @@ -30,8 +30,8 @@ Describe "Write-Error DRT Unit Tests" -Tags DRT{ $Error[0].InvocationInfo.MyCommand.Name | Should BeNullOrEmpty } - # Skip with issue #846 - It "Should be works with all parameters" -Pending { + #Blocked by issue #846 + It "Should be works with all parameters" -Pending { $exception = New-Object -TypeName System.ArgumentNullException -ArgumentList paramname Write-Error -Message myerrortext -Exception $exception -ErrorId myerrorid -Category syntaxerror -TargetObject TargetObject -CategoryActivity myactivity -CategoryReason myreason -CategoryTargetName mytargetname -CategoryTargetType mytargettype -RecommendedAction myrecommendedaction -ErrorAction SilentlyContinue $Error[0] | Should Not BeNullOrEmpty @@ -68,6 +68,16 @@ Describe "Write-Error DRT Unit Tests" -Tags DRT{ $Error[0].InvocationInfo | Should Not BeNullOrEmpty $Error[0].InvocationInfo.MyCommand.Name | Should BeNullOrEmpty } + + #Blocked by issue #846 + It "Should be works with all parameters" -Pending { + write-error -Activity fooAct -Reason fooReason -TargetName fooTargetName -TargetType fooTargetType -Message fooMessage + $Error[0].CategoryInfo.Activity | Should Be 'fooAct' + $Error[0].CategoryInfo.Reason | Should Be 'fooReason' + $Error[0].CategoryInfo.TargetName | Should Be 'fooTargetName' + $Error[0].CategoryInfo.TargetType | Should Be 'fooTargetType' + $Error[0].CategoryInfo.GetMessage() | Should Be 'NotSpecified: (fooTargetName:fooTargetType) [fooAct], fooReason' + } } Describe "Write-Error" { diff --git a/test/powershell/Write-Output.Tests.ps1 b/test/powershell/Write-Output.Tests.ps1 index 89c2210bb..fc29185a9 100644 --- a/test/powershell/Write-Output.Tests.ps1 +++ b/test/powershell/Write-Output.Tests.ps1 @@ -1,3 +1,20 @@ +Describe "Write-Output DRT Unit Tests" -Tags DRT{ + It "Simple Write Object Test" { + $objectWritten = 1, 2.2, @("John", "Smith", 10), "abc" + $results = Write-Output $objectWritten + $results.Length | Should Be $objectWritten.Length + + $results[0] | Should Be $objectWritten[0] + $results[1] | Should Be $objectWritten[1] + + $results[2] | Should Be $objectWritten[2] + $results[2] -is [System.Array] | Should Be $true + + $results[3] | Should Be $objectWritten[3] + $results[3] -is [System.String] | Should Be $true + } +} + Describe "Write-Output" { $testString = $testString Context "Input Tests" {