Files
PowerShell/test/powershell/Write-Host.Tests.ps1
T

27 lines
899 B
PowerShell
Raw Normal View History

2016-05-10 00:33:33 -07:00
Describe "Write-Host DRT Unit Tests" -Tags DRT{
$testData = @(
@{ Name = 'NoNewline';Command = "Write-Host a,b -Separator ',' -ForegroundColor Yellow -BackgroundColor DarkBlue -NoNewline"; returnValue = "a,b" }
@{ Name = 'Separator';Command = "Write-Host a,b,c -Separator '+'"; returnValue = "a+b+c" }
)
2016-05-24 23:01:22 -07:00
It "write-Host works with '<Name>' switch" -TestCases $testData -Pending:$IsOSX {
2016-05-10 00:33:33 -07:00
param($Command, $returnValue)
$tempFile = [io.path]::getTempFIleName()
$script = Join-Path $TestDrive -ChildPath writeHost.ps1
$Command > $script
2016-05-24 23:01:22 -07:00
If($IsLinux)
2016-05-10 00:33:33 -07:00
{
powershell $script > $tempFile
}
2016-05-24 23:01:22 -07:00
If ($IsWindows)
2016-05-10 00:33:33 -07:00
{
powershell.exe $script > $tempFile
}
$content = Get-Content $tempFile
$content | Should Be $returnValue
}
}