elsa-core/test/unit
Avinesh Singh ac623118a4
Propagate exceptions from command handlers correctly (#7218)
* Propagate exceptions from command handlers correctly

This is to make `CommandHandlerInvokerMiddleware` correctly 'await' the task before accessing its result, similar to how this is done in `RequestHandlerInvokerMiddleware`. Without this change, attempting to access result of a cancelled task would result in TargetInvocationException / AggregateException which breaks the task processing in `BackgroundCommandSenderHostedService` due to unhandled exception, thus breaking the background queue and particularly in bulk dispatch workflow causing remaining workflows to not get dispatched

* Address review comments

Use ExceptionDispatchInfo to prevent misleading stacktrace. As well use disposable fixture to actually dispose CommandSender,

* Address review comments

- Refactor duplicated unwrapping logic into shared InvokeAndUnwrap helper method
- Simplify CommandHandlerInvokerMiddleware to be consistent with
  RequestHandlerInvokerMiddleware (remove redundant await)
- Add Threshold property to test project for consistency

* add ConfigureAwait(false) consistently to middlewares

- Add ConfigureAwait(false) to await statements in both CommandHandlerInvokerMiddleware and RequestHandlerInvokerMiddleware for consistency and to follow library code best practices
- Increase test timeout from 50ms to 100ms for better CI reliability while still maintaining adequate margin (handler has 500ms delay)
2026-02-09 10:58:49 +01:00
..
Elsa.Activities.UnitTests Improves HTTP context loss error handling (#7187) 2026-01-12 16:51:30 +01:00
Elsa.Common.UnitTests Fix Multitenancy Support and Normalize Tenant ID Handling (#7217) 2026-01-30 19:54:13 +01:00
Elsa.Expressions.UnitTests Add code coverage configuration and adjust test projects (#7049) 2025-11-12 13:59:36 +01:00
Elsa.Http.UnitTests Add unit tests for StringExtensions.NormalizeRoute and refactor ActivityRegistryTests for cleaner setup and improved provider simulations. 2026-02-08 12:04:20 +01:00
Elsa.Mediator.UnitTests Propagate exceptions from command handlers correctly (#7218) 2026-02-09 10:58:49 +01:00
Elsa.Resilience.Core.UnitTests Enhances distributed lock handling with resilience (#7161) 2025-12-29 19:53:48 +01:00
Elsa.Scheduling.UnitTests Add Elsa Script DSL (#7076) 2025-11-25 19:57:50 +01:00
Elsa.Tenants.UnitTests Fix Multitenancy Support and Normalize Tenant ID Handling (#7217) 2026-01-30 19:54:13 +01:00
Elsa.Workflows.Core.UnitTests Add unit tests for StringExtensions.NormalizeRoute and refactor ActivityRegistryTests for cleaner setup and improved provider simulations. 2026-02-08 12:04:20 +01:00
Elsa.Workflows.Management.UnitTests Improves workflow materializer handling (#7195) 2026-01-19 08:59:12 +01:00
Elsa.Workflows.Runtime.UnitTests Merge remote-tracking branch 'origin/release/3.6.0' 2026-02-08 10:52:28 +01:00
Directory.Build.props Add coverage enforcement for test projects (#6950) 2025-10-07 19:59:53 +02:00