Merge pull request #908 from PowerShell/GetUniqueTests

Add Unit Test for Get-Unique
This commit is contained in:
Andy Schwartzmeyer committed 2016-05-06 09:57:01 -07:00
commit 77168c9f18
1 file changed
+24 -5
+24 -5
View File
@@ -1,3 +1,22 @@
Describe "Get-Unique DRT Unit Tests" -Tags DRT{
It "Command get-unique works with AsString switch" {
$inputArray = "aa","aa","Aa","ba","BA","BA"
$results = $inputArray | Get-Unique -AsString
$results.Length | Should Be 4
$results[0] | Should Be "aa"
$results[1] | Should Be "Aa"
$results[2] | Should Be "ba"
$results[3] | Should Be "BA"
$results[0].GetType().FullName | Should be System.String
$results[1].GetType().FullName | Should be System.String
$results[2].GetType().FullName | Should be System.String
$results[3].GetType().FullName | Should be System.String
}
}
Describe "Get-Unique" {
$sortedList1 = 1,2,2,3,3,4,5
It "Should be able to use the Get-Unique cmdlet without error with inputObject switch" {
@@ -59,12 +78,12 @@ Describe "Get-Unique" {
$collection = "a", "b", "b", "d"
$expectedOutput = "a", "b", "d"
$actual = Get-Unique -InputObject $collection
$actual = $collection | Get-Unique
$actual.Length | Should Be $collection.Length
$actual.Length | Should Be $expectedOutput.Length
$actual[0] | Should Be $collection[0]
$actual[1] | Should Be $collection[1]
$actual[2] | Should Be $collection[2]
$actual[0] | Should Be $expectedOutput[0]
$actual[1] | Should Be $expectedOutput[1]
$actual[2] | Should Be $expectedOutput[2]
}
}