-
Notifications
You must be signed in to change notification settings - Fork 4
/
AdvancedFunctions.tests.ps1
42 lines (34 loc) · 1.16 KB
/
AdvancedFunctions.tests.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
param(
)
$Classes = "$PSScriptRoot\Classes.ps1"
. $Classes
$Functions = "$PSScriptRoot\AdvancedFunctions.ps1"
. $Functions
Context 'Testing Advanced Functions' -Tag 'base' {
BeforeAll {
# Code to run before all
}
Describe 'Bla bla' {
BeforeEach {
# This code runs each time before It is executed
Write-Verbose -Message 'BeforeEach!' -Verbose
}
Mock 'Set-DatabaseRow' {
Write-Warning -Message 'This is not for real!'
Write-Output $InputObject
}
It 'Returns an object with a full name' {
$Result = Add-SWMember -GivenName Simon -Surname Wahlin -BirthYear 1983 -Confirm:$false -Force
$Result.FullName | Should -Be 'Simon Wahlin'
}
It 'Returns CSV toString representation' {
$Result = Add-SWMember -GivenName Simon -Surname Wahlin -BirthYear 1983 -Confirm:$false -Force
$Result.ToString() | Should -Be 'Simon Wahlin;1983'
}
}
}
Context 'Infrastructure tests' -Tag 'Infra' {
It 'W32Time is running!' {
Get-Service W32Time | Select-Object -ExpandProperty Status | Should -Be 'Running'
}
}