forked from PowerShell/PSScriptAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAvoidOneChar.tests.ps1
More file actions
23 lines (20 loc) · 867 Bytes
/
AvoidOneChar.tests.ps1
File metadata and controls
23 lines (20 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$oneCharMessage = "The cmdlet name O only has one character."
$oneCharName = "PSOneChar"
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
$invoke = Invoke-ScriptAnalyzer $directory\AvoidUsingReservedCharOneCharNames.ps1 | Where-Object {$_.RuleName -eq $oneCharName}
$noViolations = Invoke-ScriptAnalyzer $directory\GoodCmdlet.ps1 | Where-Object {$_.RuleName -eq $oneCharName}
Describe "Avoid Using One Char" {
Context "When there are violations" {
It "has 1 One Char Violation" {
$oneCharViolations.Count | Should -Be 1
}
It "has the correct description message" {
$oneCharViolations[0].Message | Should -Match $oneCharMessage
}
}
Context "When there are no violations" {
It "has no violations" {
$noReservedCharViolations.Count | Should -Be 0
}
}
}