Skip to content

Mocking cmdlet without positional parameters#477

Merged
dlwyatt merged 2 commits intopester:masterfrom
PetSerAl:positional-binding-fix
Feb 21, 2016
Merged

Mocking cmdlet without positional parameters#477
dlwyatt merged 2 commits intopester:masterfrom
PetSerAl:positional-binding-fix

Conversation

@PetSerAl
Copy link
Copy Markdown
Contributor

If advanced function does not specify any positional parameters, then PowerShell make all function parameters to be positional implicitly. This is not true for cmdlets. So that, mock of cmdlet can have different parameter binding behavior compared to original cmdlet. In v3+ you can disable implicit positional parameter binding behavior by specifying PositionalBinding=$false in CmdletBinding attribute.

@dlwyatt
Copy link
Copy Markdown
Member

dlwyatt commented Feb 21, 2016

For the record, I'm impressed! :) The Mocking code is by far the messiest, hardest to follow part of Pester, and you keep finding these little improvements that I'd never even noticed.

dlwyatt added a commit that referenced this pull request Feb 21, 2016
Mocking cmdlet without positional parameters
@dlwyatt dlwyatt merged commit d2b30da into pester:master Feb 21, 2016
@PetSerAl PetSerAl deleted the positional-binding-fix branch February 23, 2016 04:50
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.

2 participants