Files
PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Verbose.Tests.ps1
T

29 lines
995 B
PowerShell
Raw Normal View History

2016-07-25 14:01:41 -07:00
Describe "Write-Verbose" -Tags "CI" {
2016-03-04 14:48:30 -08:00
It "Should be able to call cmdlet without error" {
{ Write-Verbose -Message "test" -ErrorAction SilentlyContinue } | Should Not Throw
2016-03-04 14:48:30 -08:00
}
It "Should not display verbose output by default" {
$VerbosePreference | Should Be SilentlyContinue
2016-03-04 14:48:30 -08:00
Write-Verbose -Message "test" | Should BeNullOrEmpty
2016-03-04 14:48:30 -08:00
}
It "Should be able to set verbose output to display by changing the `$VerbosePreference automatic variable" {
$VerbosePreference = "Continue"
2016-03-04 14:48:30 -08:00
Write-Verbose -Message "test" 4>&1 | Should Not BeNullOrEmpty
2016-03-04 14:48:30 -08:00
$VerbosePreference = "SilentlyContinue"
2016-03-04 14:48:30 -08:00
}
It "Should be able to set verbose output to display by using the verbose switch" {
Write-Verbose -Message "test" -Verbose 4>&1 | Should Be "test"
2016-03-04 14:48:30 -08:00
}
It "Should be able to set verbose switch using a colon and boolean" {
{ Write-Verbose -Message "test" -Verbose:$false } | Should Not Throw
2016-03-04 14:48:30 -08:00
$(Write-Verbose -Message "test" -Verbose:$true) 4>&1 | Should Be "test"
2016-03-04 14:48:30 -08:00
}
2016-07-25 14:01:41 -07:00
}