test: harden example coverage gaps#463
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR expands PatternKit.Examples.Tests TinyBDD/xUnit coverage to close production example coverage gaps and push PatternKit.Examples above the 95% coverage floor (per #415), with added scenarios that exercise DI import surfaces, generated interpreter/facade paths, gateway routing, and additional failure branches.
Changes:
- Added new scenarios across multiple example areas (pricing, interpreter, facade, gateway routing, enterprise, domain events, context map, and transaction pipeline) to hit previously uncovered production branches.
- Strengthened the “DI importable” coverage test by resolving and executing additional registered collaborators (notifiers/identity/presence/rate-limiting).
- Extended gateway routing and pipeline demos with additional route/tender/rounding coverage.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/PatternKit.Examples.Tests/Pricing/PricingDemoTests.cs | Adds a scenario validating default pricing demo artifacts expose importable collaborators. |
| test/PatternKit.Examples.Tests/InterpreterDemo/InterpreterDemoTests.cs | Adds scenarios covering remaining generated/fluent interpreter operators, terminals, and error branches. |
| test/PatternKit.Examples.Tests/Generators/FacadeSpecsTests.cs | Adds additional facade/subsystem coverage for shipping and billing flows (including refund success path). |
| test/PatternKit.Examples.Tests/GatewayRoutingDemo/ProductGatewayRoutingDemoTests.cs | Extends routing coverage to include pricing route assertions. |
| test/PatternKit.Examples.Tests/EnterpriseDemo/EnterpriseOrderDemoTests.cs | Adds coverage for Asia fraud detector behavior. |
| test/PatternKit.Examples.Tests/DomainEventDemo/OrderDomainEventDemoTests.cs | Adds a billed-event dispatch scenario covering fluent + generated dispatcher paths. |
| test/PatternKit.Examples.Tests/DependencyInjection/PatternKitExampleDependencyInjectionTests.cs | Expands DI coverage by resolving and exercising additional notification collaborators and direct send paths. |
| test/PatternKit.Examples.Tests/ContextMapDemo/CommerceContextMapDemoTests.cs | Extends context-map test to also exercise translator mappings. |
| test/PatternKit.Examples.Tests/Chain/MediatedTransactionPipelineDemoTests.cs | Adds a new coverage-focused test class to exercise additional pipeline stages, tender failure paths, and charity tracker notifications. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ScenarioExpect.True(days > 0 && days <= 12); | ||
| } | ||
|
|
||
| [Scenario("ShippingSubsystems CoverFallbackDestinationsAndSpeeds")] |
| ScenarioExpect.Equal(29.99m, rates.CalculateBaseRate("international")); | ||
| ScenarioExpect.Equal(1.50m, rates.CalculateWeightSurcharge(8m)); | ||
| ScenarioExpect.Equal(12, estimator.EstimateDays("international", "economy")); | ||
| ScenarioExpect.Equal("$31.49 - Delivery in 12 business days", quote); |
| ScenarioExpect.Equal("Refund amount exceeds original payment", excessiveRefund.ErrorMessage); | ||
| } | ||
|
|
||
| [Scenario("BillingSubsystems CoverSuccessfulRefundPath")] |
|
|
||
| public sealed class MediatedTransactionPipelineCoverageTests | ||
| { | ||
| [Scenario("TransactionPipelineBuilder FluentHooks Cover CustomStagesRulesAndCouponDiscounts")] |
| ScenarioExpect.True(result.Ctx.Log.Contains("preauth: empty basket")); | ||
| } | ||
|
|
||
| [Scenario("CardTenderHandlers Surface AuthorizationAndCaptureFailures")] |
Test Results 12 files 12 suites 11m 22s ⏱️ Results for commit 2d6f7d8. |
Code Coverage |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #463 +/- ##
==========================================
+ Coverage 96.77% 97.08% +0.31%
==========================================
Files 579 579
Lines 47147 47147
Branches 3095 6757 +3662
==========================================
+ Hits 45626 45773 +147
+ Misses 1521 1374 -147
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 PR Validation ResultsVersion: `` ✅ Validation Steps
📊 ArtifactsDry-run artifacts have been uploaded and will be available for 7 days. This comment was automatically generated by the PR validation workflow. |
Closes #415.
Summary
Validation
dotnet test test\PatternKit.Examples.Tests\PatternKit.Examples.Tests.csproj --configuration Release -p:TestTfmsInParallel=false --filter "FullyQualifiedName~MediatedTransactionPipelineDemoTests|FullyQualifiedName~InterpreterDemoTests|FullyQualifiedName~FacadeSpecsTests"dotnet test test\PatternKit.Examples.Tests\PatternKit.Examples.Tests.csproj --configuration Release -p:TestTfmsInParallel=false --collect:"XPlat Code Coverage" --results-directory TestResults-examples-current -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura