Skip to content

Commit 87546a3

Browse files
authored
fix unit test
1 parent 07e6e8e commit 87546a3

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed
Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
#region Header
2-
. $PSScriptRoot\.tests.header.ps1
3-
#endregion
4-
5-
Describe 'Backup-StigSettings' {
6-
7-
$get = @{
8-
MitigationValue = "False"
9-
}
10-
11-
Mock Invoke-DscResource -MockWith { return $get }
12-
13-
It 'Should not throw WindowsServer' {
14-
{Backup-StigSettings -StigName "WindowsServer-2019-MS-2.9.xml"} | Should -not -Throw
15-
}
16-
17-
It 'Should not throw WindowsClient' {
18-
{Backup-StigSettings -StigName "WindowsClient-10-2.9.xml"} | Should -not -Throw
19-
}
20-
21-
It 'Should not throw Sql Server 2016' {
22-
{Backup-StigSettings -StigName "SqlServer-2016-Instance-2.12.xml"} | Should -not -Throw
23-
}
24-
25-
It 'Should return string with valid STIGs' {
26-
Backup-StigSettings -StigName "wrong.xml" | Should -BeOfType System.String
27-
}
28-
29-
$test = Get-ChildItem $ENV:TEMP | Where-Object Name -like *.csv
30-
It 'Should create a backup of current STIG Settings' {
31-
$test | Should -Not -BeNullOrEmpty
32-
}
33-
}
34-
35-
Describe 'Restore-StigSettings' {
36-
37-
$get = @{
38-
MitigationValue = "False"
39-
}
40-
41-
Mock -CommandName Invoke-DscResource -MockWith {return $get}
42-
43-
It 'Should not throw for Server' {
44-
{Restore-StigSettings -StigName "WindowsServer-2019-MS-2.9.xml" -Confirm:$false} | Should -Not -Throw
45-
}
46-
47-
It 'Should not throw for Client' {
48-
{Restore-StigSettings -StigName "WindowsClient-10-2.9.xml" -Confirm:$false} | Should -Not -Throw
49-
}
50-
51-
It 'Should not throw for Sql Server 2016' {
52-
{Restore-StigSettings -StigName "SqlServer-2016-Instance-2.12.xml" -Confirm:$false} | Should -Not -Throw
53-
}
54-
55-
}
1+
#region Header
2+
. $PSScriptRoot\.tests.header.ps1
3+
#endregion
4+
5+
Describe 'Backup-StigSettings' {
6+
7+
$get = @{
8+
MitigationValue = "False"
9+
}
10+
11+
Mock Invoke-DscResource -MockWith { return $get }
12+
13+
It 'Should not throw WindowsServer' {
14+
{Backup-StigSettings -StigName "WindowsServer-2019-MS-3.2.xml"} | Should -not -Throw
15+
}
16+
17+
It 'Should not throw WindowsClient' {
18+
{Backup-StigSettings -StigName "WindowsClient-10-3.2.xml"} | Should -not -Throw
19+
}
20+
21+
It 'Should not throw Sql Server 2016' {
22+
{Backup-StigSettings -StigName "SqlServer-2016-Instance-3.2.xml"} | Should -not -Throw
23+
}
24+
25+
It 'Should return string with valid STIGs' {
26+
Backup-StigSettings -StigName "wrong.xml" | Should -BeOfType System.String
27+
}
28+
29+
$test = Get-ChildItem $ENV:TEMP | Where-Object Name -like *.csv
30+
It 'Should create a backup of current STIG Settings' {
31+
$test | Should -Not -BeNullOrEmpty
32+
}
33+
}
34+
35+
Describe 'Restore-StigSettings' {
36+
37+
$get = @{
38+
MitigationValue = "False"
39+
}
40+
41+
Mock -CommandName Invoke-DscResource -MockWith {return $get}
42+
43+
It 'Should not throw for Server' {
44+
{Restore-StigSettings -StigName "WindowsServer-2019-MS-3.2.xml" -Confirm:$false} | Should -Not -Throw
45+
}
46+
47+
It 'Should not throw for Client' {
48+
{Restore-StigSettings -StigName "WindowsClient-10-3.2.xml" -Confirm:$false} | Should -Not -Throw
49+
}
50+
51+
It 'Should not throw for Sql Server 2016' {
52+
{Restore-StigSettings -StigName "SqlServer-2016-Instance-3.2.xml" -Confirm:$false} | Should -Not -Throw
53+
}
54+
55+
}

0 commit comments

Comments
 (0)