elsa-core/test/unit/Elsa.Resilience.Core.UnitTests
Sipke Schoorstra cf23279bf1
test(resilience): cover Elsa.Resilience.Core and lift its coverage gate off the Debug/Release seam (#7971)
`dotnet test test/unit/Elsa.Resilience.Core.UnitTests` exited 1 on a clean
checkout with all 56 tests passing. The failure was the coverlet gate, not a
test: the project pinned `<Threshold>49</Threshold>` against 48.17% measured
line coverage in Debug. Release measures slightly differently and cleared it,
so CI (which builds `--configuration Release`) stayed green while every local
run — Debug is the default — went red. A red exit for a suite that passes
trains people to ignore exit codes.

Rather than move the goalposts, cover the code. The gap was concentrated in
`ResilientActivityInvoker`, which had no tests at all, plus the serializer,
the activity-execution extensions and the retry telemetry listener.
`Elsa.Testing.Shared`'s `ActivityTestFixture` was already referenced here and
builds a real `ActivityExecutionContext`, which is what all of them needed.

Adds 40 tests. The invoker ones drive a real zero-delay Polly retry pipeline,
so the telemetry listener is exercised through the actual Polly path rather
than being called directly: pass-through when no strategy is configured, the
applied strategy recorded on the context, retry-then-succeed, one record per
retry carrying identifiers and details, null details dropped, the retries flag
and attempt count, exhausted retries rethrowing, and an unhandled exception
type not being retried. The extensions tests build a three-level context chain
to pin down that the retries flag propagates up the ancestor chain and not
down.

Line coverage goes 48.17% -> 98.17% in Debug and 97.8% in Release; the five
lines still uncovered are defensive early-returns. The threshold moves to 90,
below the lower of the two configurations with enough headroom that the
Debug/Release delta cannot straddle it again. Verified by deleting the invoker
tests once: coverage falls to 68.97% and the gate fails as it should.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 03:01:51 +02:00
..
TestHelpers test(resilience): cover Elsa.Resilience.Core and lift its coverage gate off the Debug/Release seam (#7971) 2026-08-21 03:01:51 +02:00
ActivityExecutionExtensionsTests.cs test(resilience): cover Elsa.Resilience.Core and lift its coverage gate off the Debug/Release seam (#7971) 2026-08-21 03:01:51 +02:00
DefaultTransientExceptionStrategyTests.cs Enhances distributed lock handling with resilience (#7161) 2025-12-29 19:53:48 +01:00
Elsa.Resilience.Core.UnitTests.csproj test(resilience): cover Elsa.Resilience.Core and lift its coverage gate off the Debug/Release seam (#7971) 2026-08-21 03:01:51 +02:00
ResilienceCategoryAttributeTests.cs test(resilience): cover Elsa.Resilience.Core and lift its coverage gate off the Debug/Release seam (#7971) 2026-08-21 03:01:51 +02:00
ResilienceServiceCollectionExtensionsTests.cs test(resilience): cover Elsa.Resilience.Core and lift its coverage gate off the Debug/Release seam (#7971) 2026-08-21 03:01:51 +02:00
ResilienceStrategyCatalogTests.cs Enhances distributed lock handling with resilience (#7161) 2025-12-29 19:53:48 +01:00
ResilienceStrategyConfigEvaluatorTests.cs Enhances distributed lock handling with resilience (#7161) 2025-12-29 19:53:48 +01:00
ResilienceStrategyConfigTests.cs test(resilience): cover Elsa.Resilience.Core and lift its coverage gate off the Debug/Release seam (#7971) 2026-08-21 03:01:51 +02:00
ResilienceStrategySerializerTests.cs test(resilience): cover Elsa.Resilience.Core and lift its coverage gate off the Debug/Release seam (#7971) 2026-08-21 03:01:51 +02:00
ResilientActivityInvokerTests.cs test(resilience): cover Elsa.Resilience.Core and lift its coverage gate off the Debug/Release seam (#7971) 2026-08-21 03:01:51 +02:00
TransientExceptionDetectorTests.cs Enhances distributed lock handling with resilience (#7161) 2025-12-29 19:53:48 +01:00
VoidRetryAttemptServiceTests.cs test(resilience): cover Elsa.Resilience.Core and lift its coverage gate off the Debug/Release seam (#7971) 2026-08-21 03:01:51 +02:00