test: add CurrentItemCount per-run reset tests to idempotency bases (#15)#178
Merged
Merged
Conversation
This was referenced Jun 26, 2026
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.
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 inWolfgang.Etl.Abstractions0.14.0 (already referenced onvNext):CurrentItemCount/CurrentSkippedItemCountnow reset at the start of each run.Tests added (one
[Fact]per base)IdempotentExtractorContractTests.ExtractAsync_when_called_twice_CurrentItemCount_resets_AsyncIdempotentLoaderContractTests.LoadAsync_when_called_twice_CurrentItemCount_resets_AsyncIdempotentTransformerContractTests.TransformAsync_when_called_twice_CurrentItemCount_resets_AsyncEach runs the SUT twice on the same instance, then asserts
CurrentItemCountequals 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 #246comment in each base was replaced with a note that the reset is now verified.How
CurrentItemCountis accessedCurrentItemCountis declared only on the generic Abstractions base classes (ExtractorBase<,>,LoaderBase<,>,TransformerBase<,,>); there is no non-generic base that exposes it.TProgresstype parameter, so I tightened its constraint from the interfaces towhere TSut : ExtractorBase<TItem, TProgress>, ...(matching the existingExtractorBaseContractTestsstyle) and readsut.CurrentItemCountdirectly. No new type parameter, no break to the existing consumer subclass.TProgresstype parameter. Adding one (to constrain toLoaderBase<TItem, TProgress>/TransformerBase<TItem, TItem, TProgress>) would break the existing two-arg consumer subclasses, and constraining to a hardcodedReportprogress (LoaderBase<TItem, Report>) triggered a spurious RS0016/RS0017 pair on the unrelated, already-shipped-on-vNextTryGetLoadedItemsAPI entry. Per the CLAUDE.md guidance to prefer a small protected hook when tightening would break subclasses, I added aprotected virtual int GetCurrentItemCount(TSut sut)to each base. Its default readsCurrentItemCountoffLoaderBase<TItem, Report>/TransformerBase<TItem, TItem, Report>(the ETL convention) and is overridable for non-Reportcomponents. The existing consumer subclasses useReport, so no consumer code changed.PublicAPI.Unshipped.txt entries added
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