diff --git a/test/powershell/Format-Custom.Tests.ps1 b/test/powershell/Format-Custom.Tests.ps1 index 3486a1428..df7d1144c 100644 --- a/test/powershell/Format-Custom.Tests.ps1 +++ b/test/powershell/Format-Custom.Tests.ps1 @@ -23,3 +23,22 @@ Describe "Format-Custom" { } } + + +Describe "Format-Custom DRT basic functionality" -Tags DRT{ + It "Format-Custom with subobject should work"{ + $expectResult1 = "this is the name" + $expectResult2 = "this is the name of the sub object" + $testObject = @{} + $testObject.name = $expectResult1 + $testObject.subObjectValue = @{} + $testObject.subObjectValue.name = $expectResult2 + $testObject.subObjectValue.array = (0..63) + $testObject.subObjectValue.stringarray = @("one","two") + $result = $testObject | Format-Custom | Out-String + $result | Should Match $expectResult1 + $result | Should Match $expectResult2 + $result | Should Match "one" + $result | Should Match "two" + } +} \ No newline at end of file diff --git a/test/powershell/Format-List.Tests.ps1 b/test/powershell/Format-List.Tests.ps1 index 7e8e67f57..060fea779 100644 --- a/test/powershell/Format-List.Tests.ps1 +++ b/test/powershell/Format-List.Tests.ps1 @@ -66,3 +66,65 @@ Describe "Format-List" { } } + +Describe "Format-List DRT basic functionality" -Tags DRT{ + It "Format-List with array should work"{ + $al = (0..255) + $info = @{} + $info.array = $al + $result = $info | Format-List | Out-String + $result | Should Match "Name : array\s+Value : {0, 1, 2, 3...}" + } + + It "Format-List with No Objects for End-To-End should work"{ + $p = @{} + $result = $p | Format-List -Property "foo","bar" | Out-String + $result | Should BeNullOrEmpty + } + + It "Format-List with Null Objects for End-To-End should work"{ + $p = $null + $result = $p | Format-List -Property "foo","bar" | Out-String + $result | Should BeNullOrEmpty + } + + #pending on issue#900 + It "Format-List with single line string for End-To-End should work" -pending{ + $p = "single line string" + $result = $p | Format-List -Property "foo","bar" | Out-String + $result | Should BeNullOrEmpty + } + + #pending on issue#900 + It "Format-List with multiple line string for End-To-End should work" -pending{ + $p = "Line1\nLine2" + $result = $p | Format-List -Property "foo","bar" | Out-String + $result | Should BeNullOrEmpty + } + + #pending on issue#900 + It "Format-List with string sequence for End-To-End should work" -pending{ + $p = "Line1","Line2" + $result = $p | Format-List -Property "foo","bar" | Out-String + $result | Should BeNullOrEmpty + } + + It "Format-List with complex object for End-To-End should work"{ + Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" + $eto = New-Object MyDayOfWeek + $info = @{} + $info.intArray = 1,2,3,4 + $info.arrayList = "string1","string2" + $info.enumerable = [MyDayOfWeek]$eto + $info.enumerableTestObject = $eto + $result = $info|Format-List|Out-String + $result | Should Match "Name : enumerableTestObject" + $result | Should Match "Value : Sun" + $result | Should Match "Name : arrayList" + $result | Should Match "Value : {string1, string2}" + $result | Should Match "Name : enumerable" + $result | Should Match "Value : Sun" + $result | Should Match "Name : intArray" + $result | Should Match "Value : {1, 2, 3, 4}" + } +} diff --git a/test/powershell/Format-Wide.Tests.ps1 b/test/powershell/Format-Wide.Tests.ps1 index e4b35780b..56cc40760 100644 --- a/test/powershell/Format-Wide.Tests.ps1 +++ b/test/powershell/Format-Wide.Tests.ps1 @@ -31,3 +31,60 @@ Describe "Format-Wide" { { Format-Wide -InputObject $(gps) -View aoeu } | Should Throw } } + +Describe "Format-Wide DRT basic functionality" -Tags DRT{ + It "Format-Wide with array should work"{ + $al = (0..255) + $info = @{} + $info.array = $al + $result = $info | Format-Wide | Out-String + $result | Should Match "array" + } + + It "Format-Wide with No Objects for End-To-End should work"{ + $p = @{} + $result = $p | Format-Wide | Out-String + $result | Should BeNullOrEmpty + } + + It "Format-Wide with Null Objects for End-To-End should work"{ + $p = $null + $result = $p | Format-Wide | Out-String + $result | Should BeNullOrEmpty + } + + It "Format-Wide with single line string for End-To-End should work"{ + $p = "single line string" + $result = $p | Format-Wide | Out-String + $result | Should Match $p + } + + It "Format-Wide with multiple line string for End-To-End should work"{ + $p = "Line1\nLine2" + $result = $p | Format-Wide | Out-String + $result | Should Match "Line1" + $result | Should Match "Line2" + } + + It "Format-Wide with string sequence for End-To-End should work"{ + $p = "Line1","Line2" + $result = $p |Format-Wide | Out-String + $result | Should Match "Line1" + $result | Should Match "Line2" + } + + It "Format-Wide with complex object for End-To-End should work"{ + Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" + $eto = New-Object MyDayOfWeek + $info = @{} + $info.intArray = 1,2,3,4 + $info.arrayList = "string1","string2" + $info.enumerable = [MyDayOfWeek]$eto + $info.enumerableTestObject = $eto + $result = $info|Format-Wide|Out-String + $result | Should Match "intArray" + $result | Should Match "arrayList" + $result | Should Match "enumerable" + $result | Should Match "enumerableTestObject" + } +} \ No newline at end of file