-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTest-StaticFiles.Tests.ps1
More file actions
40 lines (39 loc) · 909 Bytes
/
Test-StaticFiles.Tests.ps1
File metadata and controls
40 lines (39 loc) · 909 Bytes
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
. "$PSScriptRoot\helpers.ps1"
foreach ( $values in @(
@('webLoad.ps1','New-WebLoadPs1'),
@('readme.md','New-ReadmeMd')
))
{
$filename,$CommandName = $values
Describe $fileName {
$h = @{}
It 'get new' {
$h.new = . $CommandName
$h.new | Should -Not -BeNullOrEmpty
}
It 'get existing' {
$h.existing = Get-Content "$PSScriptRoot\$filename"
}
It 'same number of lines' {
$h.existing.Count | Should -Be $h.new.Count
}
It 'lines match' {
$i=0
foreach($line in $h.new)
{
try
{
$h.new[$i] | Should -be $h.existing[$i]
}
catch
{
throw [System.Exception]::new(
"Line $($i+1) of $filename is not as expected.",
$_.Exception
)
}
$i++
}
}
}
}