From 43c6c69dfca4a7e497d816c9341b3e42b2d29878 Mon Sep 17 00:00:00 2001 From: Kapil Borle Date: Tue, 10 May 2016 10:23:55 -0700 Subject: [PATCH] Add Name as a positional parameter for Get-ScriptAnalyzerRule --- Engine/Commands/GetScriptAnalyzerRuleCommand.cs | 2 +- Tests/Engine/GetScriptAnalyzerRule.tests.ps1 | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Engine/Commands/GetScriptAnalyzerRuleCommand.cs b/Engine/Commands/GetScriptAnalyzerRuleCommand.cs index 95ed669cc..2ec09a2c8 100644 --- a/Engine/Commands/GetScriptAnalyzerRuleCommand.cs +++ b/Engine/Commands/GetScriptAnalyzerRuleCommand.cs @@ -56,7 +56,7 @@ public SwitchParameter RecurseCustomRulePath /// /// Name: The name of a specific rule to list. /// - [Parameter(Mandatory = false)] + [Parameter(Mandatory = false, Position = 1)] [ValidateNotNullOrEmpty] [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public string[] Name diff --git a/Tests/Engine/GetScriptAnalyzerRule.tests.ps1 b/Tests/Engine/GetScriptAnalyzerRule.tests.ps1 index ef2cefc31..ab801f0cf 100644 --- a/Tests/Engine/GetScriptAnalyzerRule.tests.ps1 +++ b/Tests/Engine/GetScriptAnalyzerRule.tests.ps1 @@ -54,10 +54,15 @@ Describe "Test Name parameters" { ($rules | Where-Object {$_.RuleName -eq $approvedVerbs}).Count | Should Be 1 } - It "Get Rules with no parameters supplied" { + It "get Rules with no parameters supplied" { $defaultRules = Get-ScriptAnalyzerRule $defaultRules.Count | Should be 41 } + + It "is a positional parameter" { + $rules = Get-ScriptAnalyzerRule *alias* + $rules.Count | Should Be 1 + } } Context "When used incorrectly" {