Skip to content

Commit 3c44cf4

Browse files
committed
Improve test helper to assert against specific diagnostic type
1 parent 97d77a9 commit 3c44cf4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Tests/Rules/UseCompatibleCmdlets.tests.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ Describe "UseCompatibleCmdlets" {
2626
process
2727
{
2828
It ("found {0} violations for '{1}'" -f $expectedViolations, $command) {
29-
Invoke-ScriptAnalyzer -ScriptDefinition $command -IncludeRule $ruleName -Settings $settings | `
30-
Get-Count | `
31-
Should -Be $expectedViolations
29+
$warnings = Invoke-ScriptAnalyzer -ScriptDefinition $command -IncludeRule $ruleName -Settings $settings
30+
$warnings.Count | Should -Be $expectedViolations
31+
$warnings | ForEach-Object {
32+
$_.RuleName | Should -Be 'PSUseCompatibleCmdlets'
33+
}
3234
}
3335
}
3436
}

0 commit comments

Comments
 (0)