Files
PowerShell-PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Progress.Tests.ps1
T
James Truher 1e1c4b7dc0 Restructure of pester test layout
This restructuring moves tests to a directory name which matches the module
in which the cmdlet resides which should improve the discoverability of a
specific test.
For tests which are not about cmdlets in a module, new directories have been
created to make those tests easier to find as well
2016-06-29 12:05:41 -07:00

46 lines
1.6 KiB
PowerShell

Describe "Write-Progress DRT Unit Tests" -Tags DRT{
It "Should be able to throw exception when missing mandatory parameters" {
try
{
Write-Progress $null
Throw "Execution OK"
}
catch
{
$_.FullyQualifiedErrorId | Should Be 'ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.WriteProgressCommand'
}
}
It "Should be able to throw exception when running Write-Progress with bad percentage" {
try
{
write-progress -activity 'myactivity' -status 'mystatus' -percent 101
Throw "Execution OK"
}
catch
{
$_.FullyQualifiedErrorId | Should Be 'ParameterArgumentValidationError,Microsoft.PowerShell.Commands.WriteProgressCommand'
}
}
It "Should be able to throw exception when running Write-Progress with bad parent id " {
try
{
write-progress -activity 'myactivity' -status 'mystatus' -id 1 -parentid -2
Throw "Execution OK"
}
catch
{
$_.FullyQualifiedErrorId | Should Be 'ParameterArgumentValidationError,Microsoft.PowerShell.Commands.WriteProgressCommand'
}
}
It "all mandatory params works" -Pending {
{ write-progress -activity 'myactivity' -status 'mystatus' } | Should Not Throw
}
It "all params works" -Pending {
{ write-progress -activity 'myactivity' -status 'mystatus' -id 1 -parentId 2 -completed:$false -current 'current' -sec 1 -percent 1 } | Should Not Throw
}
}