MegaBites-AI/Windows-powershell
0372
1# Copyright (c) Microsoft Corporation.2# Licensed under the MIT License.3Describe "Out-Host Tests" -Tag CI {4 BeforeAll {5 $th = New-TestHost6 $rs = [runspacefactory]::Createrunspace($th)7 $rs.open()8 $ps = [powershell]::Create()9 $ps.Runspace = $rs10 $ps.Commands.Clear()11 }12 AfterEach {13 $ps.Commands.Clear()14 }15 AfterAll {16 $rs.Close()17 $rs.Dispose()18 $ps.Dispose()19 }20 It "Out-Host writes to host output" {21 $stringToWrite = "thing to write"22 $stringExpected = "::$($stringToWrite):NewLine"23 $result = $ps.AddScript("Out-Host -inputobject '$stringToWrite'").Invoke()24 $th.UI.Streams.ConsoleOutput.Count | Should -Be 125 $th.UI.Streams.ConsoleOutput[0] | Should -BeExactly $stringExpected26 }27}28 