Skip to content

Commit a426811

Browse files
author
Mathieu Buisson
committed
Added integration tests for MBAnalyzerRules.psm1
1 parent 60dd7b3 commit a426811

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Describe "Testing rule Measure-PascalCase against ExampleScript.ps1" {
3+
4+
$ExampleResults = Invoke-ScriptAnalyzer -Path "$($PSScriptRoot)\..\..\ExampleScript.ps1" -CustomRulePath "$($PSScriptRoot)\..\..\MBAnalyzerRules.psm1"
5+
6+
$VariableNames = $ExampleResults.Extent.Text | ForEach-Object { ($_ -split ' = ')[0].Trim('$') }
7+
$TestCases = @(
8+
@{ ExpectedViolation = 'statusUrl' },
9+
@{ ExpectedViolation = 'errorUrl' },
10+
@{ ExpectedViolation = 'NAMESPACE' },
11+
@{ ExpectedViolation = 'uwfInstance' },
12+
@{ ExpectedViolation = 'UWFEnabled' }
13+
)
14+
15+
It "Should return 6 violations" {
16+
$ExampleResults.Count | Should Be 6
17+
}
18+
It "Detected violations should contain <ExpectedViolation>" -TestCases $TestCases {
19+
Param($ExpectedViolation)
20+
$VariableNames -contains $ExpectedViolation | Should Be $True
21+
}
22+
}

0 commit comments

Comments
 (0)