-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWinToGo.tests.ps1
75 lines (50 loc) · 2.54 KB
/
WinToGo.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".")
#. "$here\$sut"
Import-Module -Name .\WinToGo.psm1 -Force
Describe 'Initialize-WTGStick Tests' {
$Disks = Get-Disk | Where-Object {$_.Size -gt 20Gb -and -not $_.IsBoot}
$DriveLetters = 68..90 | ForEach-Object {"$([char]$_):"} | Where-Object {(New-Object System.IO.DriveInfo $_).DriveType -eq 'noRootdirectory'}
$DriveIndex = 2
It 'Testing parameterarized individual Disk' {
$Result = Initialize-WTGStick -Disk $Disks[0] -ComputerName TEST
$Result | Should Not BeNullOrEmpty
$Result.DriveLetter | Should Not BeNullOrEmpty
}
It 'Testing parameterized multiple disks' {
$Result = Initialize-WTGStick -Disk $Disks -ComputerName TEST
$Result | Should Not BeNullOrEmpty
$Result.DriveLetter | Should Not BeNullOrEmpty
}
It 'Testing with pipeline support of single disk' {
$Result = $Disks[0] | Initialize-WTGStick -ComputerName TEST
$Result | Should Not BeNullOrEmpty
$Result.DriveLetter | Should Not BeNullOrEmpty
}
It 'Testing with pipeline support of multiple disks' {
$Result = $Disks | Initialize-WTGStick -ComputerName TEST
$Result | Should Not BeNullOrEmpty
$Result.DriveLetter | Should Not BeNullOrEmpty
}
}
Describe 'Write-WTGStick Tests' {
BeforeEach {
$Disks = Get-Disk | Where-Object {$_.Size -gt 20Gb -and -not $_.IsBoot}
$ImagePath = "C:\Users\Administrator\Documents\install.wim"
$Unattend = "C:\Users\Administrator\Documents\unattend.xml"
$OSVolume = Initialize-WTGStick -Disk $Disks[0] -ComputerName TEST -BitLockerPIN 11223344
$OSDriveLetter = $OSVolume.DriveLetter.ToString()
}
It 'Testing with OSDriveLetter as a String character in the parameter -DriveLetter' {
$Result = Write-WTGStick -DriveLetter $OSDriveLetter -Image $ImagePath -ComputerName TEST -Unattend $Unattend
$Result | Should BeNullOrEmpty
}
It 'Testing with OSVolume object in the parameter -DriveLetter' {
$Result = Write-WTGStick -DriveLetter $OSVolume.DriveLetter -Image $ImagePath -ComputerName TEST -Unattend $Unattend
$Result | Should BeNullOrEmpty
}
It 'Testing OSVolume as an object in the pipeline' {
$Result = $OSVolume | Write-WTGStick -Image $ImagePath -ComputerName TEST -Unattend $Unattend
$Result | Should BeNullOrEmpty
}
}