File size: 824 Bytes
8c763fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
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 -BeExactly $stringExpected
}
}
|