Skip to content

Add CommandExtensions with ExecuteIfCan on ICommand#65

Merged
Tyrrrz merged 4 commits intoprimefrom
copilot/add-powerkit-extension
Apr 18, 2026
Merged

Add CommandExtensions with ExecuteIfCan on ICommand#65
Tyrrrz merged 4 commits intoprimefrom
copilot/add-powerkit-extension

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 18, 2026

  • Rewrite FakeCommand to use callback delegates (Func<object?, bool>, Action<object?>) instead of stored state fields — matching the FakeObserver<T> pattern from ObservableTests
  • Update test bodies to use local captured variables (not class fields) and matching comment style

@Tyrrrz Tyrrrz added the enhancement New feature or request label Apr 18, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review April 18, 2026 19:56
Copilot AI review requested due to automatic review settings April 18, 2026 19:56
Comment thread PowerKit.Tests/Extensions/CommandExtensionsTests.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Ports CommandExtensions into PowerKit to provide a small convenience API for safely executing ICommand instances (source-only, no extra dependencies for supported TFMs).

Changes:

  • Added ICommand.ExecuteIfCan(object? parameter = null) extension method behind #if NETSTANDARD || NET.
  • Added unit tests covering executable vs non-executable command paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
PowerKit/Extensions/CommandExtensions.cs Introduces ExecuteIfCan extension on ICommand, compiled only on NET/NETSTANDARD.
PowerKit.Tests/Extensions/CommandExtensionsTests.cs Adds tests validating execute vs no-execute behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PowerKit/Extensions/CommandExtensions.cs
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 18, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.35%. Comparing base (ca0f66e) to head (3b6c323).
⚠️ Report is 3 commits behind head on prime.

Files with missing lines Patch % Lines
...owerKit.Tests/Extensions/CommandExtensionsTests.cs 73.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            prime      #65      +/-   ##
==========================================
- Coverage   94.89%   94.35%   -0.55%     
==========================================
  Files         120      124       +4     
  Lines        2332     2443     +111     
  Branches      177      196      +19     
==========================================
+ Hits         2213     2305      +92     
- Misses         85       97      +12     
- Partials       34       41       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…nventions

Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/58585520-7442-4bef-b18e-8d3485491435

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Copilot AI requested a review from Tyrrrz April 18, 2026 20:09
Comment thread PowerKit.Tests/Extensions/CommandExtensionsTests.cs Outdated
Copilot AI requested a review from Tyrrrz April 18, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants