From fffe79b751b4fabc303545116288d8e98f6a0cbb Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Wed, 15 Jul 2015 14:15:53 -0700 Subject: [PATCH] fixed test assumptions; is now passing tests --- src/pester-tests/Test-Get-Alias.Tests.ps1 | 31 +++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/pester-tests/Test-Get-Alias.Tests.ps1 b/src/pester-tests/Test-Get-Alias.Tests.ps1 index dccc71f271..b34e52f030 100644 --- a/src/pester-tests/Test-Get-Alias.Tests.ps1 +++ b/src/pester-tests/Test-Get-Alias.Tests.ps1 @@ -3,12 +3,39 @@ $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") . "$here\$sut" Describe "Get-Alias" { + It "Should have a return type of System.Array when gal returns more than one object" { + $val1=(Get-Alias a*) + $val2=(Get-Alias c*) + $i=0 + + $val1 | ForEach-Object{ $i++}; + if($i -lt 2) { + $val1.GetType().BaseType.FullName | Should Be "System.Management.Automation.CommandInfo" + } + else { + $val1.GetType().BaseType.FullName | Should Be "System.Array" + } + + $val2 | ForEach-Object{ $i++}; + if($i -lt 2) { + $val2.GetType().BaseType.FullName | Should Be "System.Management.Automation.CommandInfo" + } + else { + $val2.GetType().BaseType.FullName | Should Be "System.Array" + } + + } + It "should return an array of 3 objects" { - $val = Get-Alias a* + $val = Get-Alias a* + $alias = gal a* + $val.CommandType | Should Not BeNullOrEmpty $val.Name | Should Not BeNullOrEmpty $val.ModuleName | Should BeNullOrEmpty - $val.GetType().BaseType.Name | Should Be "Array" + $alias.CommandType | Should Not BeNullOrEmpty + $alias.Name | Should Not BeNullOrEmpty + $alias.ModuleName | Should BeNullOrEmpty } }