feat: add ProgressCapture<T> and ProgressAssert helpers (#14)#172
Merged
Conversation
Adds a capturing IProgress<T> implementation plus xUnit-style static assertion helpers for validating progress report sequences, replacing the manual List<T> + SynchronousProgress<T> boilerplate every downstream ETL test suite repeats today. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…lyzer baseline (#14) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Implements #14 (Progress Assertion Helpers) in
Wolfgang.Etl.TestKit.Xunit.What's new
ProgressCapture<T> : IProgress<T>(ProgressCapture.cs)A capturing, synchronous
IProgress<T>(reports on the calling thread, likeSynchronousProgress<T>) that records every reported value:IReadOnlyList<T> Reports— all captured reports, in order (returns a snapshot)T? FinalReport— last report, ordefaultif noneint Count— number of captured reportsvoid IProgress<T>.Report(T value)— appends under a lockReplaces the manual
new List<T>()+new SynchronousProgress<T>(r => list.Add(r))wiring downstream suites repeat.SynchronousProgress<T>is left in place (still used by the contract bases);ProgressCapture<T>is a separate opt-in utility.ProgressAssert(static) (ProgressAssert.cs)The five v1 assertions from the issue, each null-guarding its args (
ArgumentNullException) and throwing xUnit assertion exceptions viaAssert.*(no custom exception type):HasReports<T>(ProgressCapture<T>)HasExactly<T>(ProgressCapture<T>, int count)IsMonotonicallyIncreasing<T, TKey>(ProgressCapture<T>, Func<T, TKey>) where TKey : IComparable<TKey>— reports the breaking index in the failure messageFinalReportSatisfies<T>(ProgressCapture<T>, Func<T, bool>)— fails clearly when there are zero reportsAllReportsSatisfy<T>(ProgressCapture<T>, Func<T, bool>)— reports the breaking indexDesign decision — Option B (static asserts)
Implemented the static
ProgressAssertclass (Option B), not the fluent Option A: simpler, lower surface area, and consistent with xUnit's ownAssert.*style, per the issue's own assessment.Nullable handling across TFMs
FinalReportis typedT?on an unconstrainedT. With<Nullable>enable</Nullable>(set inDirectory.Build.props),T?on an unconstrained type parameter is the correct "maybe-null" annotation and needs no[MaybeNull]attribute — it compiles cleanly with 0 warnings across all five source TFMs (net462, net481, netstandard2.0, net8.0, net10.0) under treat-warnings-as-errors.Build & test
dotnet build src/Wolfgang.Etl.TestKit.Xunit/...csproj -c Release→ 0 warnings, 0 errors (all 5 TFMs)dotnet test tests/...Xunit.Tests.Unit -c Release -f net8.0(new tests) → 28 passed, 0 failedTestExtractor<int>throughExtractAsync(capture)and asserting monotonicCurrentItemCount+ final count, plus passing/failing cases and null-arg guards for every assertion.PublicAPI follow-up (PR #166 not yet merged)
No
PublicAPI.*.txtfiles were created (baseline lands with #166). After #166 merges, add these tosrc/Wolfgang.Etl.TestKit.Xunit/PublicAPI.Unshipped.txt:Note: the explicit interface implementation
IProgress<T>.Reportis not a public API entry.Closes #14
🤖 Generated with Claude Code