Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix Get-Alias Name parameter allows Null value#2545

Merged
vors merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:getaliasnameiSazonov/PowerShell:getaliasnameCopy head branch name to clipboard
Nov 1, 2016
Merged

Fix Get-Alias Name parameter allows Null value#2545
vors merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:getaliasnameiSazonov/PowerShell:getaliasnameCopy head branch name to clipboard

Conversation

@iSazonov

Copy link
Copy Markdown
Collaborator
  1. Add [ValidateNotNullOrEmpty()] to Name parameter
  2. Add tests

Close #2544

1. Add [ValidateNotNullOrEmpty()] to Name parameter
2. Add tests
@msftclas

Copy link
Copy Markdown

Hi @iSazonov, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@vors vors self-assigned this Oct 27, 2016
It 'Should throw if <value> is passed to -Name parameter' -TestCases $testCases {
param($data)
try {Get-Alias -Name $data }
catch [System.Management.Automation.ParameterBindingException] {$_.Exception.ErrorId | Should Be 'ParameterArgumentValidationError'}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use

 try
    {
        get-item "ThisFileCannotPossiblyExist" -ErrorAction Stop
        throw "No Exception!"
    }
    catch
    {
        $_.FullyQualifiedErrorId | should be "PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand"
    }

pattern, as described in https://github.com/PowerShell/PowerShell/blob/master/docs/testing-guidelines/WritingPesterTests.md

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Sorry. It was copy-paste 😊)
Fixed.

@vors vors merged commit cef0c54 into PowerShell:master Nov 1, 2016
@vors

vors commented Nov 1, 2016

Copy link
Copy Markdown
Collaborator

Thank you!

@iSazonov

iSazonov commented Nov 1, 2016

Copy link
Copy Markdown
Collaborator Author

@vors Thanks for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.