Skip to content

test: phase 2 HttpService coverage via injectable client factory - #31

Merged
jonas1307 merged 1 commit into
mainfrom
test/phase-2-httpservice
Jul 25, 2026
Merged

test: phase 2 HttpService coverage via injectable client factory#31
jonas1307 merged 1 commit into
mainfrom
test/phase-2-httpservice

Conversation

@jonas1307

Copy link
Copy Markdown
Owner

Phase 2 (part 2): HttpService coverage

Completes Phase 2 by covering HttpService with a stub message handler — no network access.

Production seam

  • HttpService.ClientFactory (Func<string, RestClient>, defaults to url => new RestClient(url)). Every method now builds its client through the factory; all inline new RestClient(...) calls were replaced. No public API change and no change to call sites in Program.cs.

Tests (12 new, 95 total)

Via a StubHttpMessageHandler wired through RestClientOptions.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

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.
@jonas1307
jonas1307 merged commit 9b5d488 into main Jul 25, 2026
1 check passed
@jonas1307
jonas1307 deleted the test/phase-2-httpservice branch July 25, 2026 04:01
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.

Test coverage phase 2: services with I/O

1 participant