Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mocks with enum-parameters and ValidateRange #2191

Merged
merged 10 commits into from Jun 30, 2022

Conversation

fflaten
Copy link
Collaborator

@fflaten fflaten commented Jun 20, 2022

PR Summary

Mocking a command with enum-type parameter with [ValidateRange()] attribute currently fails "Cannot find an overload for ".ctor" and the argument count: "0"." due to a bug in the ProxyCommand-generator in PowerShell. This PR parses the generated param-block to detect and fix the broken validation.

Fix #1496

PR Checklist

  • PR has meaningful title
  • Summary describes changes
  • PR is ready to be merged
    • If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • Tests are added/update (if required)
  • Documentation is updated/added (if required)

@fflaten fflaten changed the title fix mocking for enum-param with validaterange Fix mocks with enum-parameters using validaterange Jun 20, 2022
@fflaten fflaten marked this pull request as ready for review June 21, 2022 06:05
@fflaten fflaten requested review from nohwnd and removed request for nohwnd June 21, 2022 06:05
@fflaten fflaten requested a review from nohwnd June 21, 2022 15:49
@fflaten
Copy link
Collaborator Author

fflaten commented Jun 21, 2022

This time it's ready for review for real 😄

@fflaten fflaten changed the title Fix mocks with enum-parameters using validaterange Fix mocks with enum-parameters and ValidateRange Jun 21, 2022
@fflaten
Copy link
Collaborator Author

fflaten commented Jun 21, 2022

PS7_Windows_Server2019 looks like a random error.

PS6_2 missing cmdlet. Old os on that runner?
Possible to get BitsTransfer-module available on it or should I remove test since we now it works now at least?

@fflaten
Copy link
Collaborator Author

fflaten commented Jun 27, 2022

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@nohwnd nohwnd merged commit dd7d09e into pester:main Jun 30, 2022
@fflaten fflaten deleted the fix-mock-enumvalidation branch June 30, 2022 11:58
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.

Unable to Mock New-SCPhysicalComputerConfig
2 participants