test: phase 2 HttpService coverage via injectable client factory - #31
Merged
Conversation
Add a static ClientFactory seam to HttpService so its methods can run against a stub HttpMessageHandler. Covers success/failure paths for user, list/get/post/import work logs, and the RegisterActivity worklog composition (length, ids) — no network access.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2 (part 2): HttpService coverage
Completes Phase 2 by covering
HttpServicewith a stub message handler — no network access.Production seam
HttpService.ClientFactory(Func<string, RestClient>, defaults tourl => new RestClient(url)). Every method now builds its client through the factory; all inlinenew RestClient(...)calls were replaced. No public API change and no change to call sites inProgram.cs.Tests (12 new, 95 total)
Via a
StubHttpMessageHandlerwired throughRestClientOptions.ConfigureMessageHandler, with a temp config supplying URL/token/user:GetTimetrackerUser— success parse + failure throws.ListWorkLogs— parses data, sends the correct date range, includes/omits the work-item filter, failure throws.GetWorkLog/PostWorkLog/ImportWorkLogs— success + failure paths.RegisterActivity— asserts the composed worklog body (length = hours×3600, work item, activity type, and user id from config).Pack of the tool is unaffected.
Closes #29