Skip to content

test: add CurrentItemCount per-run reset tests to idempotency bases (#15)#178

Merged
Chris-Wolfgang merged 1 commit into
vNextfrom
feature/idempotency-reset-tests-15
Jun 25, 2026
Merged

test: add CurrentItemCount per-run reset tests to idempotency bases (#15)#178
Chris-Wolfgang merged 1 commit into
vNextfrom
feature/idempotency-reset-tests-15

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Adds the 3 previously-deferred CurrentItemCount-reset tests to the opt-in idempotency contract bases (the companions deferred in #15 pending ETL-Abstractions#246). #246 is resolved and live in Wolfgang.Etl.Abstractions 0.14.0 (already referenced on vNext): CurrentItemCount/CurrentSkippedItemCount now reset at the start of each run.

Tests added (one [Fact] per base)

  • IdempotentExtractorContractTests.ExtractAsync_when_called_twice_CurrentItemCount_resets_Async
  • IdempotentLoaderContractTests.LoadAsync_when_called_twice_CurrentItemCount_resets_Async
  • IdempotentTransformerContractTests.TransformAsync_when_called_twice_CurrentItemCount_resets_Async

Each runs the SUT twice on the same instance, then asserts CurrentItemCount equals a single run's item count (not 2x), proving the per-run reset contract introduced in Abstractions 0.14.0 (ETL-Abstractions#246). The stale // NOTE: deferred pending #246 comment in each base was replaced with a note that the reset is now verified.

How CurrentItemCount is accessed

CurrentItemCount is declared only on the generic Abstractions base classes (ExtractorBase<,>, LoaderBase<,>, TransformerBase<,,>); there is no non-generic base that exposes it.

  • Extractor — the base already had a TProgress type parameter, so I tightened its constraint from the interfaces to where TSut : ExtractorBase<TItem, TProgress>, ... (matching the existing ExtractorBaseContractTests style) and read sut.CurrentItemCount directly. No new type parameter, no break to the existing consumer subclass.
  • Loader / Transformer — these bases have no TProgress type parameter. Adding one (to constrain to LoaderBase<TItem, TProgress> / TransformerBase<TItem, TItem, TProgress>) would break the existing two-arg consumer subclasses, and constraining to a hardcoded Report progress (LoaderBase<TItem, Report>) triggered a spurious RS0016/RS0017 pair on the unrelated, already-shipped-on-vNext TryGetLoadedItems API entry. Per the CLAUDE.md guidance to prefer a small protected hook when tightening would break subclasses, I added a protected virtual int GetCurrentItemCount(TSut sut) to each base. Its default reads CurrentItemCount off LoaderBase<TItem, Report> / TransformerBase<TItem, TItem, Report> (the ETL convention) and is overridable for non-Report components. The existing consumer subclasses use Report, so no consumer code changed.

PublicAPI.Unshipped.txt entries added

Wolfgang.Etl.TestKit.Xunit.IdempotentExtractorContractTests<TSut, TItem, TProgress>.ExtractAsync_when_called_twice_CurrentItemCount_resets_Async() -> System.Threading.Tasks.Task!
Wolfgang.Etl.TestKit.Xunit.IdempotentLoaderContractTests<TSut, TItem>.LoadAsync_when_called_twice_CurrentItemCount_resets_Async() -> System.Threading.Tasks.Task!
virtual Wolfgang.Etl.TestKit.Xunit.IdempotentLoaderContractTests<TSut, TItem>.GetCurrentItemCount(TSut sut) -> int
Wolfgang.Etl.TestKit.Xunit.IdempotentTransformerContractTests<TSut, TItem>.TransformAsync_when_called_twice_CurrentItemCount_resets_Async() -> System.Threading.Tasks.Task!
virtual Wolfgang.Etl.TestKit.Xunit.IdempotentTransformerContractTests<TSut, TItem>.GetCurrentItemCount(TSut sut) -> int

Build & test

  • dotnet build src/Wolfgang.Etl.TestKit.Xunit -c Release — Build succeeded, 0 warnings / 0 errors across all TFMs.
  • dotnet test tests/Wolfgang.Etl.TestKit.Xunit.Tests.Unit -c Release -f net8.0 — Passed! 236/236. The 3 new reset tests pass, confirming 0.14.0 resets the count per run.

Tests only — no production code or test doubles changed.

🤖 Generated with Claude Code

)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant