Created
March 19, 2017 09:03
-
-
Save nohwnd/c57e9e67c530a656d2faae73a651cd8c to your computer and use it in GitHub Desktop.
Why Pester tests example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# author Dave Wyatt, I just copied the code from here https://blogs.technet.microsoft.com/heyscriptingguy/2015/12/14/what-is-pester-and-why-should-i-care/ | |
function TimesTwo ($value) { | |
return $value * 2 | |
} | |
Describe 'TimesTwo' { | |
Context 'Numbers' { | |
It 'Multiplies numbers properly' { | |
TimesTwo 2 | Should Be 4 | |
} | |
} | |
Context 'Strings' { | |
It 'Multiplies strings properly' { | |
TimesTwo 'Test' | Should BeExactly 'TestTest' | |
} | |
} | |
Context 'Arrays' { | |
It 'Multiplies arrays properly' { | |
$array = 1..2 | |
$result = TimesTwo $array | |
$result.Count | Should Be 4 | |
$result[0] | Should Be 1 | |
$result[1] | Should Be 2 | |
$result[2] | Should Be 1 | |
$result[3] | Should Be 2 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment