From 052165d15a0928d33276c016523f583509499b90 Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Wed, 5 Aug 2015 16:01:10 -0700 Subject: [PATCH] added test to determine if output is correct --- src/pester-tests/Test-Format-List.Tests.ps1 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index c1dc0cac3..918f2f318 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -29,8 +29,27 @@ Describe "Test-Format-List" { It "Should be able to display a list of props when separated by a comma" { $testCommand = Get-Process - { $testCommand | Format-List -Property Name,BasePriority }| Should Not Throw + { $testCommand | Format-List -Property Name,BasePriority } | Should Not Throw { $testCommand | fl -Property Name,BasePriority } | Should Not Throw } + + It "Should not show only the requested props" { + $testCommand = Get-Process + + ( $testCommand | Format-List | Out-String).Contains("CPU") | Should Be $true + ( $testCommand | Format-List -Property Name | Out-String).Contains("CPU") | Should Be $false + + ( $testCommand | fl | Out-String).Contains("CPU") | Should Be $true + ( $testCommand | fl -Property Name | Out-String).Contains("CPU") | Should Be $false + } + + It "Should be able to take input without piping objects to it" { + $input = (Get-Process)[0] + + { Format-List -InputObject $input } | Should Not Throw + + { fl -InputObject $input } | Should Not Throw + } + }