mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
28 lines
824 B
PowerShell
28 lines
824 B
PowerShell
# 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
|
|
}
|
|
}
|