2015-11-19 07:23:45 +01:00
|
|
|
Describe "Tee-Object" {
|
|
|
|
|
|
|
|
Context "Validate Tee-Object is correctly forking output" {
|
|
|
|
|
2016-03-04 23:52:27 +01:00
|
|
|
$testfile = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath testfile.txt
|
|
|
|
|
|
|
|
It "Should return the output to the screen and to the variable" {
|
|
|
|
$teefile = $testfile
|
2016-04-08 22:36:54 +02:00
|
|
|
echo teeobjecttest1 | Tee-Object -variable teeresults
|
|
|
|
$teeresults | Should Be "teeobjecttest1"
|
2016-03-04 23:52:27 +01:00
|
|
|
Remove-Item $teefile -ErrorAction SilentlyContinue
|
|
|
|
}
|
2015-11-19 07:23:45 +01:00
|
|
|
|
2016-03-04 23:52:27 +01:00
|
|
|
It "Should tee the output to a file" {
|
|
|
|
$teefile = $testfile
|
|
|
|
echo teeobjecttest3 | Tee-Object $teefile
|
|
|
|
Get-Content $teefile | Should Be "teeobjecttest3"
|
|
|
|
Remove-Item $teefile -ErrorAction SilentlyContinue
|
|
|
|
}
|
2015-11-19 07:23:45 +01:00
|
|
|
}
|
|
|
|
}
|