From c87dac7ba0929f8386d77e5f5139f87a44c28fc5 Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Wed, 18 May 2016 00:34:17 -0700 Subject: [PATCH 1/6] Add DisplayXMLTest to Pester Unit Test --- test/powershell/Format-List.Tests.ps1 | 32 +++++++++++++++++++++++++++ test/powershell/Format-Wide.Tests.ps1 | 16 ++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/test/powershell/Format-List.Tests.ps1 b/test/powershell/Format-List.Tests.ps1 index 29ad7cd0b9..2d060225dc 100644 --- a/test/powershell/Format-List.Tests.ps1 +++ b/test/powershell/Format-List.Tests.ps1 @@ -124,4 +124,36 @@ Describe "Format-List DRT basic functionality" -Tags DRT{ $result | Should Match "Name : intArray" $result | Should Match "Value : {1, 2, 3, 4}" } + + It "Format-List with multiple same class object should work"{ + Add-Type -TypeDefinition "public class TestClass{public TestClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;}" + $testobject1 = New-Object TestClass 'name1',1 + $testobject2 = New-Object TestClass 'name2',2 + $testobject3 = New-Object TestClass 'name3',3 + $testobjects = @($testobject1,$testobject2,$testobject3) + $result = $testobjects|Format-List|Out-String + $result | Should Match "Name : name1" + $result | Should Match "Length : 1" + $result | Should Match "Name : name2" + $result | Should Match "Length : 2" + $result | Should Match "Name : name3" + $result | Should Match "Length : 3" + } + + It "Format-List with multiple different class object should work"{ + Add-Type -TypeDefinition "public class TestClass{public TestClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;}" + Add-Type -TypeDefinition "public class TestClass2{public TestClass2(string name,string value,int length){Name = name;Value = value; Length = length;}public string Name;public string Value;public int Length;}" + $testobject1 = New-Object TestClass 'name1',1 + $testobject2 = New-Object TestClass2 'name2',"value2",2 + $testobject3 = New-Object TestClass 'name3',3 + $testobjects = @($testobject1,$testobject2,$testobject3) + $result = $testobjects|Format-List|Out-String + $result | Should Match "Name : name1" + $result | Should Match "Length : 1" + $result | Should Match "Name : name2" + $result | Should Match "Value : value2" + $result | Should Match "Length : 2" + $result | Should Match "Name : name3" + $result | Should Match "Length : 3" + } } diff --git a/test/powershell/Format-Wide.Tests.ps1 b/test/powershell/Format-Wide.Tests.ps1 index 89e33dfac4..2befbac99e 100644 --- a/test/powershell/Format-Wide.Tests.ps1 +++ b/test/powershell/Format-Wide.Tests.ps1 @@ -94,4 +94,20 @@ Describe "Format-Wide DRT basic functionality" -Tags DRT{ $result | Should Match "enumerable" $result | Should Match "enumerableTestObject" } + + It "Format-Wide with multiple same class object with grouping should work"{ + Add-Type -TypeDefinition "public class TestGroupingClass{public TestGroupingClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;public string GroupingKey;}" + $testobject1 = New-Object TestGroupingClass 'name1',1 + $testobject1.GroupingKey = "foo" + $testobject2 = New-Object TestGroupingClass 'name2',2 + $testobject1.GroupingKey = "bar" + $testobject3 = New-Object TestGroupingClass 'name3',3 + $testobject1.GroupingKey = "bar" + $testobjects = @($testobject1,$testobject2,$testobject3) + $result = $testobjects|Format-Wide -GroupBy GroupingKey|Out-String + $result | Should Match "GroupingKey: bar" + $result | Should Match "name1" + $result | Should Match " GroupingKey:" + $result | Should Match "name2\s+name3" + } } From dd3ee79c8915ad2a2aa56db28dd2fa4ead6c15ee Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Wed, 18 May 2016 01:30:12 -0700 Subject: [PATCH 2/6] Fix OSX fail for DisplayXML Pester Test --- test/powershell/Format-List.Tests.ps1 | 4 ++-- test/powershell/Format-Wide.Tests.ps1 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/powershell/Format-List.Tests.ps1 b/test/powershell/Format-List.Tests.ps1 index 2d060225dc..0c24fe5855 100644 --- a/test/powershell/Format-List.Tests.ps1 +++ b/test/powershell/Format-List.Tests.ps1 @@ -125,7 +125,7 @@ Describe "Format-List DRT basic functionality" -Tags DRT{ $result | Should Match "Value : {1, 2, 3, 4}" } - It "Format-List with multiple same class object should work"{ + It "Format-List with multiple same class object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){ Add-Type -TypeDefinition "public class TestClass{public TestClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;}" $testobject1 = New-Object TestClass 'name1',1 $testobject2 = New-Object TestClass 'name2',2 @@ -140,7 +140,7 @@ Describe "Format-List DRT basic functionality" -Tags DRT{ $result | Should Match "Length : 3" } - It "Format-List with multiple different class object should work"{ + It "Format-List with multiple different class object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){ Add-Type -TypeDefinition "public class TestClass{public TestClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;}" Add-Type -TypeDefinition "public class TestClass2{public TestClass2(string name,string value,int length){Name = name;Value = value; Length = length;}public string Name;public string Value;public int Length;}" $testobject1 = New-Object TestClass 'name1',1 diff --git a/test/powershell/Format-Wide.Tests.ps1 b/test/powershell/Format-Wide.Tests.ps1 index 2befbac99e..015752378d 100644 --- a/test/powershell/Format-Wide.Tests.ps1 +++ b/test/powershell/Format-Wide.Tests.ps1 @@ -95,7 +95,7 @@ Describe "Format-Wide DRT basic functionality" -Tags DRT{ $result | Should Match "enumerableTestObject" } - It "Format-Wide with multiple same class object with grouping should work"{ + It "Format-Wide with multiple same class object with grouping should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){ Add-Type -TypeDefinition "public class TestGroupingClass{public TestGroupingClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;public string GroupingKey;}" $testobject1 = New-Object TestGroupingClass 'name1',1 $testobject1.GroupingKey = "foo" From 1504f9b64fb3fd7a4fa0c85131c6fd8304eb0daf Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Thu, 19 May 2016 01:51:16 -0700 Subject: [PATCH 3/6] Add Format-Custom Tree object Pester Test --- test/powershell/Format-Custom.Tests.ps1 | 256 ++++++++++++++++++++++++ 1 file changed, 256 insertions(+) diff --git a/test/powershell/Format-Custom.Tests.ps1 b/test/powershell/Format-Custom.Tests.ps1 index 7c7782e876..0c28189460 100644 --- a/test/powershell/Format-Custom.Tests.ps1 +++ b/test/powershell/Format-Custom.Tests.ps1 @@ -26,6 +26,38 @@ Describe "Format-Custom" { Describe "Format-Custom DRT basic functionality" -Tags DRT{ + Add-Type -TypeDefinition @" + public abstract class NamedItem + { + public string name; + } + + public abstract class MyContainerBase : NamedItem + { + public System.Collections.Generic.List children = new System.Collections.Generic.List (); + } + + public sealed class MyLeaf1 : NamedItem + { + public int val1 = 0; + } + + public sealed class MyLeaf2 : NamedItem + { + public int val2 = 0; + } + + public sealed class MyContainer1 : MyContainerBase + { + public string data1; + } + + public sealed class MyContainer2 : MyContainerBase + { + public string data2; + } +"@ + It "Format-Custom with subobject should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { $expectResult1 = "this is the name" $expectResult2 = "this is the name of the sub object" @@ -41,4 +73,228 @@ Describe "Format-Custom DRT basic functionality" -Tags DRT{ $result | Should Match "one" $result | Should Match "two" } + + It "Format-Custom with Tree Object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $expectedResult=@" +class MyContainer1 +{ + data1 = data 1 + children = + [ + class MyLeaf1 + { + val1 = 10 + name = leaf 1 + } + class MyLeaf2 + { + val2 = 20 + name = leaf 2 + } + ] + + name = container 1 +} + +class MyContainer2 +{ + data2 = data 2 + children = + [ + class MyLeaf1 + { + val1 = 10 + name = leaf 1 + } + class MyLeaf2 + { + val2 = 20 + name = leaf 2 + } + ] + + name = container 2 +} + +class MyContainer2 +{ + data2 = data 2 deep + children = + [ + class MyContainer1 + { + data1 = cx data + children = + [ + class MyLeaf1 + { + val1 = 10 + name = leaf 1 + } + class MyLeaf2 + { + val2 = 20 + name = leaf 2 + } + ] + + name = cx + } + ] + + name = container 2 deep +} + +class MyContainer1 +{ + data1 = cx data + children = + [ + class MyLeaf1 + { + val1 = 10 + name = leaf 1 + } + class MyLeaf2 + { + val2 = 20 + name = leaf 2 + } + ] + + name = cx +} +"@ + $leaf1 = New-Object MyLeaf1 + $leaf1.name = "leaf 1" + $leaf1.val1 = 10 + + $leaf2 = New-Object MyLeaf2 + $leaf2.name = "leaf 2" + $leaf2.val2 = 20 + + $c1 = New-Object MyContainer1 + $c1.name = "container 1" + $c1.data1 = "data 1" + $c1.children.Add($leaf1) + $c1.children.Add($leaf2) + + $c2 = New-Object MyContainer2 + $c2.name = "container 2" + $c2.data2 = "data 2" + $c2.children.Add($leaf1) + $c2.children.Add($leaf2) + + $cDeep = New-Object MyContainer2 + $cDeep.name = "container 2 deep" + $cDeep.data2 = "data 2 deep" + + $cx= New-Object MyContainer1 + $cx.name = "cx" + $cx.data1 = "cx data" + $cx.children.Add($leaf1) + $cx.children.Add($leaf2) + $cDeep.children.Add($cx) + + $objectList = @($c1,$c2,$cDeep,$cx) + $result = $objectList | Format-Custom | Out-String + $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $result | Should Be $expectedResult + } + + It "Format-Custom with Empty Data Tree Object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $expectedResult=@" +class MyContainer1 +{ + data1 = + children = + name = +} +"@ + + $c= New-Object MyContainer1 + $c.name = $null + $c.data1 = $null + $c.children = $null + $objectList = @($c) + + $result = $objectList | Format-Custom | Out-String + $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $result | Should Be $expectedResult + } + + It "Format-Custom with Back Pointers Tree Object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $expectedResult=@" +class MyContainer1 +{ + data1 = + children = + [ + class MyContainer1 + { + data1 = + children = + [ + class MyContainer1 + { + data1 = + children = + [ + MyContainer1 + ] + + name = ROOT + } + ] + + name = ROOT + } + ] + + name = ROOT +} +"@ + + $root= New-Object MyContainer1 + $root.name = "ROOT" + $root.children.Add($root) + $objectList = @($root) + + $result = $objectList | Format-Custom | Out-String + $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $result | Should Be $expectedResult + } + + It "Format-Custom with Tree Object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $expectedResult=@" +class MyLeaf1 +{ + val1 = 10 + name = leaf 1 +} + +class MyLeaf2 +{ + val2 = 20 + name = leaf 2 +} +"@ + + $leaf1 = New-Object MyLeaf1 + $leaf1.name = "leaf 1" + $leaf1.val1 = 10 + + $leaf2 = New-Object MyLeaf2 + $leaf2.name = "leaf 2" + $leaf2.val2 = 20 + + $objectList = @($leaf1,$leaf2) + $result = $objectList | Format-Custom | Out-String + $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $result | Should Be $expectedResult + } } From 0dc339f5798b8e07918a28194ee4f8e1cf63ea8a Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Thu, 19 May 2016 02:09:59 -0700 Subject: [PATCH 4/6] Update Format-Custom Tree object Pester Test --- test/powershell/Format-Custom.Tests.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/powershell/Format-Custom.Tests.ps1 b/test/powershell/Format-Custom.Tests.ps1 index 0c28189460..0b225966eb 100644 --- a/test/powershell/Format-Custom.Tests.ps1 +++ b/test/powershell/Format-Custom.Tests.ps1 @@ -198,8 +198,8 @@ class MyContainer1 $objectList = @($c1,$c2,$cDeep,$cx) $result = $objectList | Format-Custom | Out-String - $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" - $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" + $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" $result | Should Be $expectedResult } @@ -220,8 +220,8 @@ class MyContainer1 $objectList = @($c) $result = $objectList | Format-Custom | Out-String - $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" - $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" + $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" $result | Should Be $expectedResult } @@ -263,12 +263,12 @@ class MyContainer1 $objectList = @($root) $result = $objectList | Format-Custom | Out-String - $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" - $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" + $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" $result | Should Be $expectedResult } - It "Format-Custom with Tree Object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + It "Format-Custom with Leaf Only Data should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { $expectedResult=@" class MyLeaf1 { @@ -293,8 +293,8 @@ class MyLeaf2 $objectList = @($leaf1,$leaf2) $result = $objectList | Format-Custom | Out-String - $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" - $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" + $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" + $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" $result | Should Be $expectedResult } } From 1d6ab11ea82ac66e9f1bd0e3276825fb4f4d048d Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Thu, 19 May 2016 22:06:14 -0700 Subject: [PATCH 5/6] Update fix based on comment for DisplayXML Pester Test --- test/powershell/Format-Custom.Tests.ps1 | 16 ++++++++-------- test/powershell/Format-List.Tests.ps1 | 14 +++++++------- test/powershell/Format-Wide.Tests.ps1 | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/powershell/Format-Custom.Tests.ps1 b/test/powershell/Format-Custom.Tests.ps1 index 0b225966eb..64afb70ffa 100644 --- a/test/powershell/Format-Custom.Tests.ps1 +++ b/test/powershell/Format-Custom.Tests.ps1 @@ -198,8 +198,8 @@ class MyContainer1 $objectList = @($c1,$c2,$cDeep,$cx) $result = $objectList | Format-Custom | Out-String - $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" - $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" + $result = $result -replace "[{} `n\r]","" + $expectedResult = $expectedResult -replace "[{} `n\r]","" $result | Should Be $expectedResult } @@ -220,8 +220,8 @@ class MyContainer1 $objectList = @($c) $result = $objectList | Format-Custom | Out-String - $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" - $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" + $result = $result -replace "[{} `n\r]","" + $expectedResult = $expectedResult -replace "[{} `n\r]","" $result | Should Be $expectedResult } @@ -263,8 +263,8 @@ class MyContainer1 $objectList = @($root) $result = $objectList | Format-Custom | Out-String - $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" - $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" + $result = $result -replace "[{} `n\r]","" + $expectedResult = $expectedResult -replace "[{} `n\r]","" $result | Should Be $expectedResult } @@ -293,8 +293,8 @@ class MyLeaf2 $objectList = @($leaf1,$leaf2) $result = $objectList | Format-Custom | Out-String - $result = $result -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" - $expectedResult = $expectedResult -replace "{","" -replace "}","" -replace " ","" -replace "`n","" -replace "\r","" + $result = $result -replace "[{} `n\r]","" + $expectedResult = $expectedResult -replace "[{} `n\r]","" $result | Should Be $expectedResult } } diff --git a/test/powershell/Format-List.Tests.ps1 b/test/powershell/Format-List.Tests.ps1 index 0c24fe5855..bd43b01d45 100644 --- a/test/powershell/Format-List.Tests.ps1 +++ b/test/powershell/Format-List.Tests.ps1 @@ -108,7 +108,7 @@ Describe "Format-List DRT basic functionality" -Tags DRT{ It "Format-List with complex object for End-To-End should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" - $eto = New-Object MyDayOfWeek + $eto = [MyDayOfWeek]::New() $info = @{} $info.intArray = 1,2,3,4 $info.arrayList = "string1","string2" @@ -127,9 +127,9 @@ Describe "Format-List DRT basic functionality" -Tags DRT{ It "Format-List with multiple same class object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){ Add-Type -TypeDefinition "public class TestClass{public TestClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;}" - $testobject1 = New-Object TestClass 'name1',1 - $testobject2 = New-Object TestClass 'name2',2 - $testobject3 = New-Object TestClass 'name3',3 + $testobject1 = [TestClass]::New('name1',1) + $testobject2 = [TestClass]::New('name2',2) + $testobject3 = [TestClass]::New('name3',3) $testobjects = @($testobject1,$testobject2,$testobject3) $result = $testobjects|Format-List|Out-String $result | Should Match "Name : name1" @@ -143,9 +143,9 @@ Describe "Format-List DRT basic functionality" -Tags DRT{ It "Format-List with multiple different class object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){ Add-Type -TypeDefinition "public class TestClass{public TestClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;}" Add-Type -TypeDefinition "public class TestClass2{public TestClass2(string name,string value,int length){Name = name;Value = value; Length = length;}public string Name;public string Value;public int Length;}" - $testobject1 = New-Object TestClass 'name1',1 - $testobject2 = New-Object TestClass2 'name2',"value2",2 - $testobject3 = New-Object TestClass 'name3',3 + $testobject1 = [TestClass]::New('name1',1) + $testobject2 = [TestClass2]::New('name2',"value2",2) + $testobject3 = [TestClass]::New('name3',3) $testobjects = @($testobject1,$testobject2,$testobject3) $result = $testobjects|Format-List|Out-String $result | Should Match "Name : name1" diff --git a/test/powershell/Format-Wide.Tests.ps1 b/test/powershell/Format-Wide.Tests.ps1 index 015752378d..c3a51491a8 100644 --- a/test/powershell/Format-Wide.Tests.ps1 +++ b/test/powershell/Format-Wide.Tests.ps1 @@ -97,11 +97,11 @@ Describe "Format-Wide DRT basic functionality" -Tags DRT{ It "Format-Wide with multiple same class object with grouping should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){ Add-Type -TypeDefinition "public class TestGroupingClass{public TestGroupingClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;public string GroupingKey;}" - $testobject1 = New-Object TestGroupingClass 'name1',1 + $testobject1 = [TestGroupingClass]::New('name1',1) $testobject1.GroupingKey = "foo" - $testobject2 = New-Object TestGroupingClass 'name2',2 + $testobject2 = [TestGroupingClass]::New('name2',2) $testobject1.GroupingKey = "bar" - $testobject3 = New-Object TestGroupingClass 'name3',3 + $testobject3 = [TestGroupingClass]::New('name3',3) $testobject1.GroupingKey = "bar" $testobjects = @($testobject1,$testobject2,$testobject3) $result = $testobjects|Format-Wide -GroupBy GroupingKey|Out-String From 4005348f458e115d7d7c7e0126753e6b09ed46da Mon Sep 17 00:00:00 2001 From: JumpingYang001 Date: Mon, 23 May 2016 20:10:55 -0700 Subject: [PATCH 6/6] Update fixes based on James comments for DisplayXML Pester Test --- test/powershell/Format-List.Tests.ps1 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/test/powershell/Format-List.Tests.ps1 b/test/powershell/Format-List.Tests.ps1 index bd43b01d45..60ccdf9a5f 100644 --- a/test/powershell/Format-List.Tests.ps1 +++ b/test/powershell/Format-List.Tests.ps1 @@ -127,10 +127,7 @@ Describe "Format-List DRT basic functionality" -Tags DRT{ It "Format-List with multiple same class object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){ Add-Type -TypeDefinition "public class TestClass{public TestClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;}" - $testobject1 = [TestClass]::New('name1',1) - $testobject2 = [TestClass]::New('name2',2) - $testobject3 = [TestClass]::New('name3',3) - $testobjects = @($testobject1,$testobject2,$testobject3) + $testobjects = [TestClass]::New('name1',1),[TestClass]::New('name2',2),[TestClass]::New('name3',3) $result = $testobjects|Format-List|Out-String $result | Should Match "Name : name1" $result | Should Match "Length : 1" @@ -143,10 +140,7 @@ Describe "Format-List DRT basic functionality" -Tags DRT{ It "Format-List with multiple different class object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){ Add-Type -TypeDefinition "public class TestClass{public TestClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;}" Add-Type -TypeDefinition "public class TestClass2{public TestClass2(string name,string value,int length){Name = name;Value = value; Length = length;}public string Name;public string Value;public int Length;}" - $testobject1 = [TestClass]::New('name1',1) - $testobject2 = [TestClass2]::New('name2',"value2",2) - $testobject3 = [TestClass]::New('name3',3) - $testobjects = @($testobject1,$testobject2,$testobject3) + $testobjects = [TestClass]::New('name1',1),[TestClass2]::New('name2',"value2",2),[TestClass]::New('name3',3) $result = $testobjects|Format-List|Out-String $result | Should Match "Name : name1" $result | Should Match "Length : 1"