Skip to content

Commit c176c90

Browse files
ggorlenkazk
andauthored
Flesh out Pester example (#403)
* Flesh out Pester example * Remove PSScriptRoot approach Co-authored-by: kazk <[email protected]> Co-authored-by: kazk <[email protected]>
1 parent 9fe4c60 commit c176c90

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

content/languages/powershell/pester.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,34 @@ tags:
99

1010
# Pester
1111

12+
## Basic Setup
13+
14+
### Solution Code
15+
16+
```powershell
17+
function Add-Numbers($a, $b) {
18+
return $a + $b
19+
}
20+
```
21+
22+
### Test Fixture
23+
24+
```powershell
25+
BeforeAll {
26+
. $PSCommandPath.Replace(".Tests.ps1", ".ps1")
27+
}
28+
29+
Describe "Add-Numbers" {
30+
It "adds positive numbers" {
31+
Add-Numbers 1 1 | Should -Be 2
32+
}
33+
It "adds negative numbers" {
34+
Add-Numbers 1 -6 | Should -Be -5
35+
}
36+
}
37+
```
38+
39+
1240
<!--
1341
TODO: Finish this reference
1442
TODO: Add tutorial and link to it

0 commit comments

Comments
 (0)