From ca2dce35376f7f3cbe9008bb74d842803b3508ff Mon Sep 17 00:00:00 2001 From: "Jason Shirk (POWERSHELL)" Date: Fri, 11 Nov 2016 19:17:50 -0800 Subject: [PATCH] Improve coverage for Write-Information output --- .../Write-Stream.Tests.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 index e47bc19a3b..859fb2afc4 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 @@ -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" } }