forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWrite-Progress.Tests.ps1
More file actions
45 lines (41 loc) · 1.57 KB
/
Copy pathWrite-Progress.Tests.ps1
File metadata and controls
45 lines (41 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Describe "Write-Progress DRT Unit Tests" -Tags "CI" {
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
}
}