PowerShell/test/powershell/Format-Table.Tests.ps1

40 lines
1.3 KiB
PowerShell
Raw Normal View History

2015-10-23 01:35:31 +02:00
Describe "Format-Table" {
2015-08-04 09:31:30 +02:00
It "Should call format table on piped input without error" {
{ Get-Process | Format-Table } | Should Not Throw
{ Get-Process | ft } | Should Not Throw
}
It "Should return a format object data type" {
$val = (Get-Process | Format-Table | gm )
$val2 = (Get-Process | Format-Table | gm )
$val.TypeName | Should Match "Microsoft.Powershell.Commands.Internal.Format"
2015-08-04 20:19:41 +02:00
$val2.TypeName | Should Match "Microsoft.Powershell.Commands.Internal.Format"
2015-08-04 09:31:30 +02:00
}
It "Should be able to be called with optional parameters" {
$v1 = (Get-Process | Format-Table *)
$v2 = (Get-Process | Format-Table -Property ProcessName)
$v3 = (Get-Process | Format-Table -GroupBy ProcessName)
$v4 = (Get-Process | Format-Table -View StartTime)
$v12 = (Get-Process | ft *)
$v22 = (Get-Process | ft -Property ProcessName)
$v32 = (Get-Process | ft -GroupBy ProcessName)
$v42 = (Get-Process | ft -View StartTime)
{ $v1 } | Should Not Throw
{ $v2 } | Should Not Throw
{ $v3 } | Should Not Throw
{ $v4 } | Should Not Throw
{ $v12 } | Should Not Throw
{ $v22 } | Should Not Throw
{ $v32 } | Should Not Throw
{ $v42 } | Should Not Throw
}
}