From e880aa58a6c3fe7a97790462ab9e2532e2cfd35a Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Thu, 19 Nov 2015 06:23:45 +0000 Subject: [PATCH] Added pester tests for Tee-Object --- src/pester-tests/Tee-Object.Tests.ps1 | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/pester-tests/Tee-Object.Tests.ps1 diff --git a/src/pester-tests/Tee-Object.Tests.ps1 b/src/pester-tests/Tee-Object.Tests.ps1 new file mode 100644 index 0000000000..1fd926b4ac --- /dev/null +++ b/src/pester-tests/Tee-Object.Tests.ps1 @@ -0,0 +1,35 @@ +$here = Split-Path -Parent $MyInvocation.MyCommand.Path + +Describe "Tee-Object" { + + Context "Validate Tee-Object is correctly forking output" { + + It "Should return the output to the screen and to the variable" { + $teefile = "$here/assets/testfile.txt" + echo teeobjecttest1 | Tee-Object -variable teeresults + $teeresults | Should Be "teeobjecttest1" + Remove-Item $teefile -ErrorAction SilentlyContinue + } + + It "Should return the output to the screen and to the variable from the alias" { + $teefile = "$here/assets/testfile.txt" + echo teeobjecttest2 | tee -variable teeresults + $teeresults | Should Be "teeobjecttest2" + Remove-Item $teefile -ErrorAction SilentlyContinue + } + + It "Should tee the output to a file" { + $teefile = "$here/assets/testfile.txt" + echo teeobjecttest3 | Tee-Object $teefile + Get-Content $teefile | Should Be "teeobjecttest3" + Remove-Item $teefile -ErrorAction SilentlyContinue + } + + It "Should tee the output to a file using the alias" { + $teefile = "$here/assets/testfile.txt" + echo teeobjecttest4 | tee $teefile + Get-Content $teefile | Should Be "teeobjecttest4" + Remove-item $teefile -ErrorAction SilentlyContinue + } + } +}