2016-03-04 22:48:30 +00:00
|
|
|
Describe "Write-Verbose" {
|
|
|
|
It "Should be able to call cmdlet without error" {
|
2016-03-04 22:52:27 +00:00
|
|
|
{ Write-Verbose -Message "test" -ErrorAction SilentlyContinue } | Should Not Throw
|
2016-03-04 22:48:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should not display verbose output by default" {
|
2016-03-04 22:52:27 +00:00
|
|
|
$VerbosePreference | Should Be SilentlyContinue
|
2016-03-04 22:48:30 +00:00
|
|
|
|
2016-03-04 22:52:27 +00:00
|
|
|
Write-Verbose -Message "test" | Should BeNullOrEmpty
|
2016-03-04 22:48:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should be able to set verbose output to display by changing the `$VerbosePreference automatic variable" {
|
2016-03-04 22:52:27 +00:00
|
|
|
$VerbosePreference = "Continue"
|
2016-03-04 22:48:30 +00:00
|
|
|
|
2016-03-04 22:52:27 +00:00
|
|
|
Write-Verbose -Message "test" 4>&1 | Should Not BeNullOrEmpty
|
2016-03-04 22:48:30 +00:00
|
|
|
|
2016-03-04 22:52:27 +00:00
|
|
|
$VerbosePreference = "SilentlyContinue"
|
2016-03-04 22:48:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should be able to set verbose output to display by using the verbose switch" {
|
2016-03-04 22:52:27 +00:00
|
|
|
Write-Verbose -Message "test" -Verbose 4>&1 | Should Be "test"
|
2016-03-04 22:48:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
It "Should be able to set verbose switch using a colon and boolean" {
|
2016-03-04 22:52:27 +00:00
|
|
|
{ Write-Verbose -Message "test" -Verbose:$false } | Should Not Throw
|
2016-03-04 22:48:30 +00:00
|
|
|
|
2016-03-04 22:52:27 +00:00
|
|
|
$(Write-Verbose -Message "test" -Verbose:$true) 4>&1 | Should Be "test"
|
2016-03-04 22:48:30 +00:00
|
|
|
}
|
2015-11-19 19:29:16 +00:00
|
|
|
}
|