Skip to content

Add test coverage for TimeSpreadCalculator #665

Description

@Hirogen

Background

Timestamp Locator extraction, merged in #664 rewired TimeSpreadCalculator off ILogWindow and onto the pure TimestampLocator + ITimestampSource seam. That was the blocker to testing it — the calculator no longer needs a WinForms LogWindow to run, only a fake ITimestampSource, the same seam TimestampLocatorTests.cs already exercises.

It remains untested. DoCalc and DoCalcViaTime (the two spread algorithms — line-mode and time-mode) have no coverage, and DoCalcViaTime carries a pre-existing //TODO Refactor this method marker of its own.

What to build

Test coverage for TimeSpreadCalculator's two calculation paths (DoCalc, DoCalcViaTime) against a fake ITimestampSource + TimestampLocator, in the same style as src/LogExpert.Tests/Timestamp/TimestampLocatorTests.cs. The worker-thread/event-driven surface (WorkerFx, _calcEvent, _lineCountEvent) needs its own think about whether to test through it or extract the calculation from the threading — do that thinking as part of this ticket, not before it.

Acceptance criteria

  • DoCalc (line mode) has test coverage: empty file, single line, no timestamps, uniform spacing, irregular gaps
  • DoCalcViaTime (time mode) has equivalent coverage
  • Tests run without instantiating any WinForms type
  • Solution builds; all existing tests still pass

Blocked by

None — TimeSpreadCalculator is already rewired onto the testable seam.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions