-
Notifications
You must be signed in to change notification settings - Fork 0
/
MSI.Tests.ps1
58 lines (47 loc) · 1.33 KB
/
MSI.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#Requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.2.0' }
#Requires -Module @{ ModuleName = 'MSI'; ModuleVersion = '3.0.0' }
param(
[Parameter()]
[ValidateNotNullOrEmpty()]
[String]
$Name = 'CcgVault',
[Parameter()]
[System.IO.DirectoryInfo]
$InstallPath ,
[Parameter()]
[System.Version]
$ExpectedVersion = $env:CCG_BUILD_VER
)
BeforeAll {
$Script:msi = Get-MSIProductInfo -Name $Name
[System.IO.DirectoryInfo]$Script:path = if ($InstallPath) {
$InstallPath
}
else {
$env:ProgramFiles | Join-Path -ChildPath $Name
}
}
Describe 'MSI tests' -Tag Msi {
Context 'Present' -Tag Present {
It '<Name> is installed' {
$msi | Should -Not -BeNullOrEmpty
}
It 'Only one version of <Name> is installed' {
$msi | Should -HaveCount 1
}
It '<Name> should be version <ExpectedVersion>' {
$msi.ProductVersion | Should -Be $ExpectedVersion
}
It 'Install directory "<path>" should be present' {
$path.Exists | Should -BeTrue
}
}
Context 'Absent' -Tag Absent {
It '<Name> is not installed' {
$msi | Should -BeNullOrEmpty
}
It 'Install directory should be absent' {
$path.Exists | Should -BeFalse
}
}
}