-
Notifications
You must be signed in to change notification settings - Fork 4
better tests #19
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
better tests #19
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19 +/- ##
=======================================
Coverage 77.95% 77.95%
=======================================
Files 2 2
Lines 186 186
Branches 28 28
=======================================
Hits 145 145
Misses 21 21
Partials 20 20
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors the test suite for MinimalWorker to improve organization, maintainability, and test coverage. The main change involves breaking down a monolithic TestDependency.cs file into well-organized helper classes, fake implementations, and test types across dedicated namespaces.
Changes:
- Reorganized test infrastructure by splitting
TestDependency.csintoHelpers/,Fakes/, andTestTypes/folders with properly namespaced classes - Introduced
TestConstantsto replace magic numbers throughout tests, using bounded ranges for execution count assertions - Added comprehensive new test cases covering edge cases (zero interval timers, invalid cron expressions, error handler exceptions, builder pattern edge cases)
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/MinimalWorker.Test/TestDependency.cs | Removed monolithic test helper file (227 lines deleted) |
| test/MinimalWorker.Test/Fakes/* | Extracted fake services into organized files with improved thread-safety using Interlocked operations |
| test/MinimalWorker.Test/Helpers/* | Created helper utilities (WorkerTestHelper, TestConstants, LoggingTestHelper) for test infrastructure |
| test/MinimalWorker.Test/TestTypes/WorkerSettings.cs | Extracted configuration type for IOptions testing |
| test/MinimalWorker.Test/*Tests.cs | Updated imports and replaced magic numbers with TestConstants; improved assertions with bounded ranges |
| test/MinimalWorker.Test/BuilderPatternTests.cs | New test file covering fluent API edge cases (196 lines) |
| test/MinimalWorker.Test/PeriodicWorkerTests.cs | Added tests for non-overlapping executions and zero interval handling |
| test/MinimalWorker.Test/TelemetryTests.cs | Added tests for cron activity tags and gauge measurements |
| test/MinimalWorker.Test/ErrorHandlerTests.cs | Added tests for error handler exceptions and inner exception preservation |
| test/MinimalWorker.Test/CronWorkerTests.cs | Added tests for error recovery, day-of-week schedules, and invalid expressions |
| test/MinimalWorker.Test/ContinuousWorkerTests.cs | Added test for synchronous work in async context |
| test/MinimalWorker.Test/ServiceResolutionTests.cs | Added test for transient service resolution |
| .claude/settings.local.json | Added Claude desktop permissions for dotnet test and build commands |
| var listener = new ActivityListener | ||
| { | ||
| ShouldListenTo = source => source.Name == "MinimalWorker", | ||
| Sample = (ref ActivityCreationOptions<ActivityContext> options) => ActivitySamplingResult.AllData, | ||
| ActivityStarted = activity => | ||
| { | ||
| lock (activities) | ||
| { | ||
| activities.Add(activity); | ||
| } | ||
| if (signalOnFirst) | ||
| { | ||
| signal.TrySetResult(true); | ||
| } | ||
| } | ||
| }; |
Copilot
AI
Jan 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disposable 'ActivityListener' is created but not disposed.
| var listener = new ActivityListener | ||
| { | ||
| ShouldListenTo = source => source.Name == "MinimalWorker", | ||
| Sample = (ref ActivityCreationOptions<ActivityContext> options) => ActivitySamplingResult.AllData, | ||
| ActivityStopped = activity => | ||
| { | ||
| lock (activities) | ||
| { | ||
| activities.Add(activity); | ||
| } | ||
| if (signalCondition == null || signalCondition(activity)) | ||
| { | ||
| signal.TrySetResult(true); | ||
| } | ||
| } | ||
| }; |
Copilot
AI
Jan 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disposable 'ActivityListener' is created but not disposed.
No description provided.