PowerShell/test/powershell/Modules/Microsoft.PowerShell.Core/Out-Host.Tests.ps1
Ilya a99fb531e6 Add autoload for test modules (#3342)
Related #3238

1. Add autoload for test modules
2. Move TestHostCS.psm1 to 'test\tools\Modules\' folder
3. Remove explicit load TestHostCS.psm1 from test files
2017-03-26 21:46:39 -07:00

25 lines
742 B
PowerShell

Describe "Out-Host Tests" -tag CI {
BeforeAll {
$th = New-TestHost
$rs = [runspacefactory]::Createrunspace($th)
$rs.open()
$ps = [powershell]::Create()
$ps.Runspace = $rs
$ps.Commands.Clear()
}
AfterEach {
$ps.Commands.Clear()
}
AfterAll {
$rs.Close()
$rs.Dispose()
$ps.Dispose()
}
It "Out-Host writes to host output" {
$stringToWrite = "thing to write"
$stringExpected = "::$($stringToWrite):NewLine"
$result = $ps.AddScript("Out-Host -inputobject '$stringToWrite'").Invoke()
$th.UI.Streams.ConsoleOutput.Count | should be 1
$th.UI.Streams.ConsoleOutput[0] | should be $stringExpected
}
}