Improve coverage for Write-Information output

This commit is contained in:
Jason Shirk (POWERSHELL)
2016-11-14 14:03:30 -08:00
committed by Dongbo Wang
parent 0d3021c5ca
commit ca2dce3537
@@ -75,6 +75,18 @@ Describe "Stream writer tests" -Tags "CI" {
$result = Write-Information "Test Message" *>&1
$result.GetType().Fullname | Should be "System.Management.Automation.InformationRecord"
$result.NativeThreadId | Should Not Be 0
$result.ProcessId | Should Be $pid
if ($IsWindows)
{
# Use Match instead of Be so we can avoid dealing with a potential domain name
$result.Computer | Should Match ".*${env:COMPUTERNAME}"
$result.User | Should Match ".*${env:USERNAME}"
}
else
{
$result.Computer | Should Be $(uname -n)
$result.User | Should Be $(whoami)
}
"$result" | Should be "Test Message"
}
}