-
Notifications
You must be signed in to change notification settings - Fork 0
/
My.Test.ps1
54 lines (40 loc) · 985 Bytes
/
My.Test.ps1
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
46
47
48
49
50
51
52
53
54
Test 'Without Scope' -Tag 'NoScope' {
}
Scope 'Outer' -Tag 'Outer' {
Test 'Good test' {
Write-Output 'Outer'
}
Scope 'Inner' -Tag 'Inner' {
ForEach($i in (0..2)) {
Test "Good - $i" -Tag 'Good' {
Write-Output "Good output $i"
}
Test "Skippy - $i" -Skip {
Write-Output "Good output $i"
}
Test "Bad - $i" -Tag 'Bad' {
Throw "Bad error $i"
}
}
}
Scope 'SkippedScope' -Skip {
Test 'SkippedTest' {
Throw 'Test should be Skipped'
}
}
}
Scope 'ScopeWithSetupTeardown' {
Before {
$script:x = 12;
}
Scope 'Tests' {
Test 'Test x' {
if ($script:x -ne 12) {
Throw "x should be 12 but is $($script:x)"
}
}
}
After {
$script:x = $null;
}
}