Updated `MicrosoftVersion` and `ResilienceVersion` to `10.0.0`.
Restructured `<ItemGroup>` elements for better organization.
Added conditional `<ItemGroup>` entries for `net8.0`, `net9.0`,
and `net10.0` target frameworks to specify appropriate
`Microsoft.EntityFrameworkCore` package versions.
Preserved existing package versions and configurations.
* Refactor workflow instance deletion to use `IWorkflowRuntime` for enhanced coordination and separation of concerns.
* Remove `EnumerableTypeConverter` and update related usages for serialization.
- Deleted the `EnumerableTypeConverter` class and its JSON serialization logic.
- Removed associated type descriptor attribute in `DefaultFormattersFeature`.
- Updated `ObjectFormatter` to handle collection serialization directly with JSON.
* Remove `EnumerableTypeConverter` tests and consolidate serialization logic into `ObjectFormatter`.
- Deleted `EnumerableTypeConverterTests` as the related functionality was removed.
- Added comprehensive tests in `ObjectFormatterTests` to handle serialization of collections and arrays with JSON.
* Add integration tests for `TriggerIndexer` to handle workflows with failing materialization
- Introduced comprehensive test scenarios verifying `DeleteTriggersAsync` behavior when workflows fail to load or partially succeed.
- Enhanced error handling in `TriggerIndexer` to skip failed workflows while ensuring remaining workflows are processed.
* Add exception handling in `TriggerIndexer.DeleteTriggersAsync` and integration tests
- Enhanced `DeleteTriggersAsync` with exception handling to skip failed workflows while processing others.
- Logged warnings for failed workflows without halting execution.
- Added comprehensive integration tests to verify behavior across success, failure, and mixed scenarios.
- Refactored tests for improved clarity, maintainability, and consistency.
* Add exception handling for `ResumeWorkflowTask` to skip deleted workflow instances
- Enhanced `ResumeWorkflowTask.ExecuteAsync` to handle `WorkflowInstanceNotFoundException` gracefully when a scheduled workflow instance is missing.
- Logged warnings for skipped executions to improve observability.
- Ensured remaining workflows and scheduled tasks are processed seamlessly without disruption.
* Add thread safety to `LocalScheduler` to prevent race conditions during concurrent scheduling
- Introduced a `lock` object to synchronize access to internal dictionaries.
- Resolved `IndexOutOfRangeException` caused by concurrent modifications during startup.
- Ensured thread-safe operations in `ScheduleAsync`, `ClearScheduleAsync`, and related methods.
- Improved reliability and stability of scheduling under concurrent workloads.
* Improve exception handling, thread safety, and workflow instance deletion
- Added exception handling in `TriggerIndexer.DeleteTriggersAsync` to skip failed workflows while continuing processing.
- Enhanced `ResumeWorkflowTask` to handle missing workflow instances gracefully and log warnings.
- Introduced thread synchronization in `LocalScheduler` with `lock` to prevent concurrent access issues.
- Implemented and refactored tests to ensure behavior consistency and improve maintainability.
- Added component tests for workflow deletion scenarios, covering running, completed, and non-existent workflows.
* Add component tests for workflow instance deletion and refactor bulk delete logic
- Added comprehensive component tests for workflow instance deletion scenarios (running, completed, bulk, and non-existent instances).
- Refactored `BulkDelete` API to use `IWorkflowInstanceManager` for proper cleanup of related records (execution logs, activity executions, bookmarks).
* Add integration tests and fakes for `TriggerIndexer` to verify behavior with failing and successful workflows
- Introduced `FailingMaterializer` and `WorkingMaterializer` for simulating failing and successful workflow materializations.
- Added `TriggerDeletionTestScenario`, `TriggerTestDataBuilder`, and related test data classes to define comprehensive test cases.
- Updated `DeleteTriggersAsync` tests with scenarios for materialization failures and mixed success.
- Improved test coverage and maintainability with reusable test data builders and utilities.
* Upgrade projects to target .NET 10, add conditional `System.Linq.Async` dependencies for compatibility with earlier frameworks, and update project files for consistency across the solution.
* Suppress null comparison warning in `WorkflowDefinitionStore` and remove xUnit references from performance test project.
* Refactor performance test projects to remove xUnit references and update MSBuild properties for BenchmarkDotNet.
Updated multiple package versions in `Directory.Packages.props` to ensure compatibility, security, and access to the latest features. Key updates include `MicrosoftVersion` to `9.0.11`, `BenchmarkDotNet` to `0.15.6`, `FastEndpoints` to `7.1.1`, and `System.CommandLine` to `2.0.0`.
Refactored `DesignTimeDbContextFactoryBase<TDbContext>` to align with the updated `System.CommandLine` API. Simplified `RootCommand` initialization and replaced deprecated `GetValueForOption` with `GetValue`.
* Enhance null-safety annotations across modules and refactor for improved consistency:
- Added `null!` annotations to enforce non-nullability expectations.
- Updated workflows, tests, and runtime services to handle default null values reliably.
- Removed obsolete and unused APIs, simplifying interfaces and improving maintainability.
- Refactored methods and properties for clarity, thread-safety, and consistency.
- Adjusted test configurations for code coverage tracking and integration improvements.
* Refactor activity iteration in container serialization tests to simplify type casting.
* Simplify test setup by removing `Input` wrapper and fix trimming warnings with `UnconditionalSuppressMessage` annotations.
* Add trimming warning suppression to `ArgumentJsonConverter` with `UnconditionalSuppressMessage`
- Annotated `Read` method to suppress `IL2055` warning caused by dynamic type resolution.
- Provided justification reflecting dynamic type registration in the well-known type registry.
* Add root namespace to project file and suppress EF Core usage warning
- Added `RootNamespace` property to `Elsa.Persistence.EFCore.Common.csproj` for consistency.
- Annotated `DbSchemaAwareMigrationAssembly` with `SuppressMessage` to suppress EF1001 usage warning and provide justification.
* Suppress obsolete API warnings in workflow runtime projects
- Added `#pragma warning disable CS0618` to suppress obsolete member warnings in `ObsoleteWorkflowRuntime.cs`, `LocalWorkflowRuntime.Obsolete.cs`, and `DistributedWorkflowRuntime.Obsolete.cs`.
- Updated `Directory.Build.props` to globally suppress `CS0618` for backward compatibility during migration.
* Annotate properties with non-nullable default initializers across modules to enforce null safety.
* Add `Priority` and `Deprecated` properties to `StorageDriverDescriptor` model
* Update src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.Obsolete.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update src/modules/Elsa.Workflows.Runtime/Services/ObsoleteWorkflowRuntime.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.Obsolete.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Clean up XML comments and improve consistency across modules.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add code coverage configuration and adjust test projects
- Introduced `Include` and `Threshold` properties across test project files for improved code coverage tracking.
- Added `coverlet.collector` as a dependency for coverage data collection.
- Removed unused `global using` directives and redundant imports for cleaner test codebases.
* Update GitHub Actions workflows for pull request triggers
- Adjusted `pr.yml` to include `patch/*` and `develop/*` branches.
- Removed redundant pull request triggers in `packages.yml` for cleaner configuration.
* Expand pull request triggers in GitHub Actions
- Renamed `PR` workflow to `pr` for consistency.
- Included `patch/*` and `develop/*` branches in `pr.yml` and `Build.CI.GitHubActions.cs`.
* Remove pack target from pull request workflows
- Updated `pr.yml` to exclude the pack step.
- Adjusted `Build.CI.GitHubActions.cs` to reflect the removal of the pack target.
* Remove `Elsa.Workflows.Api` from integration test project references
- Updated `Elsa.Workflows.IntegrationTests.csproj` to exclude `Elsa.Workflows.Api` from the `Include` list and project references for cleanup and simplification.
* Added IEnumerableTypeConverter
* fixed bug and added tests
* Add resource disposal mechanism in ScheduledCronTask
- Introduced `_disposed` flag to prevent execution after disposal.
- Updated disposal logic to ensure proper release of resources.
- Adjusted unit tests to verify new disposal behavior and prevent unintended timer actions.
* Enhance scheduling tasks with edge case handling and disposal improvements
- Added `_disposed` flag to `ScheduledRecurringTask` and `ScheduledSpecificInstantTask` to prevent execution after disposal.
- Adjusted timer setup logic to handle zero/negative delays with a minimum delay of 1ms.
- Updated disposal logic to ensure proper resource cleanup even during timer callbacks.
- Introduced extensive unit tests for edge cases such as small, zero, or negative delay scenarios and proper disposal behavior.
* Update test/component/Elsa.Workflows.ComponentTests/Scenarios/VariablesArray/Activities/RemoveTopElementStep.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update src/modules/Elsa.Common/Serialization/IEnumerableTypeConverter.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update src/modules/Elsa.Common/Serialization/IEnumerableTypeConverter.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add integration tests for EnumerableTypeConverter and update solution file
- Introduced `Elsa.Common.IntegrationTests` project for testing serialization behavior in `EnumerableTypeConverter`.
- Added tests to verify proper handling of strings, byte arrays, and collections during JSON serialization.
- Registered `EnumerableTypeConverter` in `DefaultFormattersFeature`.
- Renamed `IEnumerableTypeConverter` to `EnumerableTypeConverter` for consistency.
- Updated solution file to include the new integration test project.
---------
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Renames the `CancelAncestorActivatesAsync` method to `CancelAncestorActivitiesAsync` for clarity and makes it a proper async method, ensuring correct asynchronous execution.
This prevents potential issues when cancelling ancestor activities.
* Fix semaphore release logic in scheduled task execution
- Ensure `_executionSemaphore` is only released when acquired.
- Refactor `acquired` variable initialization for better reliability and readability across `ScheduledRecurringTask`, `ScheduledCronTask`, and `ScheduledSpecificInstantTask`.
* Fix test isolation in WorkflowDefinitionActivity cache eviction test (#7046)
* Add thread-safety and resource disposal to `WorkflowDefinitionActivity`
- Introduced `SemaphoreSlim` to ensure thread-safe initialization.
- Implemented `IDisposable` to clean up semaphore resources.
* Introduce thread-safety in `CacheManager` with per-key locking
- Added `ConcurrentDictionary` for managing per-key `SemaphoreSlim` instances.
- Ensured thread-safe `GetOrCreateAsync` operations with key-specific locks.
- Cleaned up unused locks when cache entries are removed.
* Add definition IDs filter to WorkflowDefinitionActivityTests
- Updated `WorkflowInstanceFilter` to include `DefinitionIds` for more precise faulted workflow filtering.
- Improved test coverage for workflow definition scenarios.
* Revert "Introduce thread-safety in `CacheManager` with per-key locking"
This reverts commit cda89d4e6aea1810364cdb0145a59d7b6448bc49.
* Revert "Add thread-safety and resource disposal to `WorkflowDefinitionActivity`"
This reverts commit 08750890a16a8b539941d6d161b4061d2fdbe1b8.
* Remove unnecessary whitespace in WorkflowDefinitionActivityTests
* Fork unit tests
* Refactor `ForkTests` to improve readability and maintainability
- Replace inline initializations with consistent formatting for `Branches` property.
- Simplify test setups and replace redundant initializations with `CompleteBranchAsync`.
- Enhance assertions by removing unused properties and redundant comments.
- Consolidate and streamline helper method logic for consistent activity behavior.
* Refactor `CreateBranches` method in `ForkTests` for improved readability and consistency
---------
Co-authored-by: lucas.hipolito <lukhipolito@yahoo.com.br>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
* Add DispatchWorkflow tests with new workflow definitions
- Introduced multiple workflow definitions with varied scenarios including input handling, correlation IDs, and fault handling.
- Enhanced `DispatchWorkflowsTests` with comprehensive test cases to validate `DispatchWorkflow` behavior under different configurations.
- Updated existing workflows and tests for improved structure, readability, and accuracy.
- Refactored and renamed related workflows for consistency across test suites.
* Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/DispatchWorkflows/DispatchWorkflowsTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor DispatchWorkflowsTests for readability and maintainability
- Replaced hardcoded constants with named variables for improved clarity.
- Enhanced assertions using utility methods like `Assert.Single` for cleaner code.
- Updated WriteLine activity tests to handle null values reliably.
- Introduced timeout handling for child workflow execution.
* Update GUID length validation in JintJavaScriptFunctionBehaviorTests
- Adjusted `shortGuid` length assertion to accommodate a range of 19-22 characters instead of 20-22.
* Add extensive unit and component tests for scheduling activities
- Introduced unit tests for `Cron`, `Delay`, `Timer`, and `StartAt` scheduling activities, covering general usage and corner cases.
- Added component tests validating `Cron`, `Delay`, `Timer`, and `StartAt` workflows within broader scenarios, focusing on workflow execution, blocking, and resumption of activities.
- Enhanced test project structures with new folder setups aligning to activity categories.
- Updated namespaces and project files to match the new structure and added validation for scheduling logic.
* Refactor Timer activity tests for consistency and reusability
- Extracted shared logic for timer activity tests into `TimerActivityTestBase`.
- Refactored `DelayTests`, `TimerTests`, `CronTests`, and `StartAtTests` to inherit from `TimerActivityTestBase`.
- Removed redundant code and improved test consistency across all timer activity test cases.
- Cleaned up unused imports and optimized namespaces.
* Remove unused folder references from test project files
* [WIP] Update unit and component tests for scheduling activities (#7037)
* Initial plan
* Replace ContainsKey + indexer with TryGetValue in CronTests
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
* Fixing build after merge
* Remove DispatchWorkflowsTests and related references from the test suite
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Co-authored-by: lucas.hipolito <lukhipolito@yahoo.com.br>
* Add DispatchWorkflow tests with new workflow definitions
- Introduced multiple workflow definitions with varied scenarios including input handling, correlation IDs, and fault handling.
- Enhanced `DispatchWorkflowsTests` with comprehensive test cases to validate `DispatchWorkflow` behavior under different configurations.
- Updated existing workflows and tests for improved structure, readability, and accuracy.
- Refactored and renamed related workflows for consistency across test suites.
* Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/DispatchWorkflows/DispatchWorkflowsTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor DispatchWorkflowsTests for readability and maintainability
- Replaced hardcoded constants with named variables for improved clarity.
- Enhanced assertions using utility methods like `Assert.Single` for cleaner code.
- Updated WriteLine activity tests to handle null values reliably.
- Introduced timeout handling for child workflow execution.
* Update GUID length validation in JintJavaScriptFunctionBehaviorTests
- Adjusted `shortGuid` length assertion to accommodate a range of 19-22 characters instead of 20-22.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Refactor BulkDispatchWorkflows tests and improve activity coverage
- Migrate `BulkDispatchWorkflows` tests to a new structure under `Scenarios/BulkDispatch`.
- Introduce comprehensive test cases for bulk dispatch scenarios, including empty items, correlation IDs, child ports, dictionary items, and invalid definitions.
- Add multiple reusable workflows such as `BulkChildWorkflow`, `BulkDispatchAndWaitWorkflow`, and `BulkDispatchFireAndForgetWorkflow` for enhanced test coverage.
- Update namespaces and project files to reflect the restructuring and new workflow definitions.
- Enhance functionality for `IWorkflowInstanceVariableManager` by adding methods for variable retrieval from workflow states and instances.
* Add additional assertions for WriteLine activity tests and update workflow builder in BulkDispatch tests
- Enhanced `BulkDispatchWorkflowsTests` by validating written texts for accuracy.
- Refactored `BulkDispatchFireAndForgetWorkflow` to update activity and namespace references.
* Add `SlowBulkChildWorkflow` and update `BulkDispatchFireAndForgetWorkflow` test structure
- Introduced `SlowBulkChildWorkflow` with a delay and logging functionality for bulk dispatch testing.
- Modified `BulkDispatchFireAndForgetWorkflow` to use `SlowBulkChildWorkflow` and updated test items.
- Enhanced `BulkDispatchWorkflowsTests` with child workflow completion validation and timing assertions.
* Refactor BulkDispatch tests by removing dictionary item workflow and streamlining child workflow handling
- Removed `BulkDispatchWithDictionaryItemsWorkflow` and associated test cases.
- Updated `BulkChildWorkflow` to use input binding.
- Streamlined child workflow event handling in `BulkDispatchWorkflowsTests` using a reusable helper method.
- Enhanced `CorrelationIdFunction` support with JavaScript expression handling.
* Move unit test workflows to `Scenarios/Activities` and update namespace references
- Relocated all test workflows from `Scenarios/BulkDispatch` and `Scenarios/ExecuteWorkflows` to `Scenarios/Activities`.
- Updated namespaces and imports to reflect the new folder structure.
* Refactor BulkDispatch and FlowJoin test workflows:
- Moved `BulkDispatch` workflows to `Scenarios/Activities/BulkDispatchWorkflows`.
- Renamed `FlowJoins` to `FlowJoin` and updated namespaces to match.
- Adjusted imports and references to align with new folder structure and updated class definitions.
* Remove unused folder reference from `Elsa.Workflows.ComponentTests.csproj`.
* Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/BulkDispatchWorkflows/BulkDispatchWorkflowsTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Replace StreamWriter-based RawStringContent with ByteArrayContent-based implementation to guarantee bytes written == Content-Length.
- Pre-encode string to byte[] using provided Encoding (no BOM), and set Content-Type without charset.
- Update JsonContentFactory to use the new RawStringContent to avoid length mismatches under load/bulk dispatch.
* Add unit tests for `ExecuteWorkflow` activity covering various scenarios and refactor `FlowJoin` activity to remove `[Obsolete]` attribute.
* Add integration tests for `ExecuteWorkflow` activity
- Introduce parent and child workflow definitions to test various scenarios, including input handling, output capture, correlation ID setting, and execution order.
- Add corresponding JSON workflow files for integration tests.
- Update project files to include new workflows.
* Refactor `ExecuteWorkflowTests` to consolidate repetitive code by introducing utility methods for workflow execution and instance retrieval.
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update doc/qa/test-guidelines.md
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
* Improvements on maintainability of sendhttprequest unit tests
* Improving tests and scheduled activity evaluation for activity context
* Refactor and splitting unnecessary grouped tests
* Improvements on SendHttp Unit tests
* Improvements on tests
* Update test/unit/Elsa.Activities.UnitTests/HTTP/SendHttpRequestTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Small suggestions from copilot
* Update test/unit/Elsa.Activities.UnitTests/HTTP/SendHttpRequestTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* small copilot suggestion
* Introduce Scheduler Strategy Interfaces and Implementations for Workflow and Activity Execution Contexts
- Added `IWorkflowExecutionContextSchedulerStrategy` and `IActivityExecutionContextSchedulerStrategy` interfaces.
- Implemented `WorkflowExecutionContextSchedulerStrategy` and `ActivityExecutionContextSchedulerStrategy` for scheduling activities in workflows.
- Refactored scheduling logic to utilize the new scheduler strategies.
- Updated unit tests and test helpers to reflect refactoring, introducing fake implementations for testing purposes.
- Adjusted background execution scheduling and improved extensibility for custom scheduler strategies.
* Refactor `SendHttpRequestTests`: simplify scheduling assertions, use shared extensions, and standardize method naming. Streamline helper methods and remove unused test logic.
* Refactor: Replace `ActivityTestHelper` with `ActivityTestFixture` in unit tests for streamlined activity testing
- Introduced `ActivityTestFixture` with a fluent API for better test setup and execution of activities.
- Added extension methods `ActivityTestFixtureExtensions` and `ActivityTestFixtureHttpExtensions` for configuring attributes and HTTP services.
- Updated test guidelines and unit tests to use the new fixture and extensions.
- Removed `ActivityTestHelper`.
* Refactor: Move `ActivityTestFixture` and related extensions to shared project for reuse across test suites
- Consolidated `ActivityTestFixture`, `ActivityTestFixtureExtensions`, and `ActivityTestFixtureHttpExtensions` into `Elsa.Testing.Shared`.
- Updated namespaces and imports across unit tests to reflect new structure.
- Enhanced `AssertActivityAttributes` and added fluent configuration APIs.
- Adjusted `Directory.Packages.props` with new dependencies, including `NSubstitute` and `xunit.assert`.
* Refactor `SetVariableTests`: inline `ActivityTestFixture` initialization to simplify test setup.
* Refactor `ActivityTestFixture`: eliminate redundant field `_services`, add `UsedImplicitly` attributes, and improve service collection management
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add XML documentation for `ActivityExecutionContextExtensions`, detailing methods and parameters.
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add XML documentation for scheduler strategies and their methods
- Updated `IActivityExecutionContextSchedulerStrategy` and `IWorkflowExecutionContextSchedulerStrategy` interfaces with XML summaries for methods.
- Added XML documentation to implementations (`ActivityExecutionContextSchedulerStrategy`, `WorkflowExecutionContextSchedulerStrategy`) and test fakes for clarity.
* Refactor `WriteLineTests`: consolidate duplicate test logic, simplify setup with shared helper method, and enhance readability in assertions.
* Refactor `WriteLineTests` and `SetVariableTests`: replace `WriteLineAsync` assertions with synchronous `WriteLine`, streamline exception recording in `SetVariableTests`, and remove unused imports.
* Add new unit and integration tests for activity input and expression evaluation
- Introduced comprehensive test suites covering activity input evaluation, expression handling, and fault scenarios.
- Added unit tests for `ExpressionDescriptorRegistry`, `ExpressionEvaluator`, and activity execution context extensions.
- Added integration tests: `CustomInputEvaluatorTests`, `InputEvaluationErrorTests`, and `InputPropertyEvaluationTests`.
- Enhanced code coverage for edge cases and async evaluation logic.
* Remove unused `RunWorkflowAsync` extension method from `RunActivityExtensions`.
* Rename `CustomInputEvaluatorTests` to `InputEvaluationTests` for consistency with naming conventions.
* Remove unused `Elsa.Workflows.Activities` import from `RunActivityExtensions`.
* Remove redundant comments from `InputEvaluationErrorTests` for clarity.
* Refactor unit tests to streamline activity and expression evaluations
- Refactored `ExecuteActivityAsync` and `ExecuteWriteLineAsync` into shared helpers for consistency and reuse across tests.
- Replaced redundant mock setups with helper methods in `ExpressionDescriptorRegistryTests`.
- Simplified test setup for expression and activity evaluation by removing unused imports and consolidating configuration logic.
- Enhanced readability by reducing duplicate code and leveraging shared utility methods.
* Refactor activity input evaluation tests
- Extracted `CreateContextAsync` helper into `EvaluationTestHelpers` for reuse across evaluation test suites.
- Replaced inline activity context setup with shared helper in `InputPropertyEvaluationTests`, `WrappedInputEvaluationTests`, and related test suites.
- Simplified test method names for clarity and consistency.
- Updated test annotations to enhance readability and align with naming conventions.
* Remove redundant test cases and unused imports
- Deleted duplicated and non-essential test cases across evaluation test suites.
- Removed unused imports to improve code cleanliness and readability.
- Streamlined variable initializations and method calls within test setups.
* Remove redundant test case from `InputEvaluationErrorTests`
- Deleted the `ContinuesEvaluationForMultipleInputs` test, as it overlaps with existing tests and does not provide additional coverage.
* Remove redundant assertion from `InputPropertyEvaluationTests`
- Deleted `Assert.True(context.GetHasEvaluatedProperties())`, as it is unnecessary for verifying test outcomes.
* Remove redundant test cases from `WrappedInputEvaluationTests`
- Deleted `UsesDefaultValueWhenInputIsNull` and `EvaluatesExpression` tests as they are either duplicated or unnecessary for current test coverage.
* Add unit test projects for `Elsa.Workflows.Management` and `Elsa.Expressions`
- Introduced new test projects to separate and organize unit tests for `Elsa.Workflows.Management` and `Elsa.Expressions`.
- Updated `Elsa.sln` to include references to the newly added test projects.
- Adjusted namespaces in affected test classes for consistency with the updated project structure.
* Refactor `ExpressionEvaluatorTests` for clarity and consistency
- Simplified test method names and annotations for improved readability.
- Replaced duplicate mock setups with helper functions (`CreateContextAsync`, `CreateContextWithMockHandlerAsync`, and related methods).
- Streamlined test setups by removing redundant code and consolidating context creation logic.
- Updated test annotations to include descriptive `DisplayName` attributes.
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Remove redundant comment from `ExpressionEvaluatorTests` for clarity
* Remove redundant blank lines from unit test classes
- Eliminated unnecessary blank lines across `ActivityExecutionContextExtensions` test suites to improve code readability and consistency.
* Add unit tests for Flowchart activity
- Introduced `FlowchartTests` to verify common Flowchart behavior, including start activity scheduling, execution without a start activity, and `UseTokenFlow` handling.
- Added `FlowchartTestHelpers` to encapsulate shared test logic.
- Updated project file to include the new `Flow` folder for organization.
* Add integration tests for Flowchart activity execution strategies
- Introduced `FlowchartCounterBasedTests` and `FlowchartTokenBasedTests` to verify different Flowchart execution strategies.
- Added `FlowchartTestHelpers` for shared test logic, including helper methods for creating various flowchart configurations and connections.
- Enhanced test coverage with scenarios for linear, parallel, and conditional flows, mixed merge modes, nested flowcharts, and token handling.
- Updated project structure to include new test classes under the `Flow` folder.
* Remove obsolete tag from `FlowJoin` activity description
* Handle both string and enum values in `GetMergeMode` for backwards compatibility
* Group flowchart integration tests into non-parallelizable test collection
- Introduced `FlowchartTestCollection` to prevent parallel execution of flowchart tests due to shared `Flowchart.UseTokenFlow` flag.
- Updated `FlowchartCounterBasedTests` and `FlowchartTokenBasedTests` to implement `IDisposable` and manage `UseTokenFlow` cleanup.
* Remove unused `Flow` folder reference from test project file
* Introduce Scheduler Strategy Interfaces and Implementations for Workflow and Activity Execution Contexts (#6984)
* Introduce Scheduler Strategy Interfaces and Implementations for Workflow and Activity Execution Contexts
- Added `IWorkflowExecutionContextSchedulerStrategy` and `IActivityExecutionContextSchedulerStrategy` interfaces.
- Implemented `WorkflowExecutionContextSchedulerStrategy` and `ActivityExecutionContextSchedulerStrategy` for scheduling activities in workflows.
- Refactored scheduling logic to utilize the new scheduler strategies.
- Updated unit tests and test helpers to reflect refactoring, introducing fake implementations for testing purposes.
- Adjusted background execution scheduling and improved extensibility for custom scheduler strategies.
* Refactor `SendHttpRequestTests`: simplify scheduling assertions, use shared extensions, and standardize method naming. Streamline helper methods and remove unused test logic.
* Refactor: Replace `ActivityTestHelper` with `ActivityTestFixture` in unit tests for streamlined activity testing
- Introduced `ActivityTestFixture` with a fluent API for better test setup and execution of activities.
- Added extension methods `ActivityTestFixtureExtensions` and `ActivityTestFixtureHttpExtensions` for configuring attributes and HTTP services.
- Updated test guidelines and unit tests to use the new fixture and extensions.
- Removed `ActivityTestHelper`.
* Refactor: Move `ActivityTestFixture` and related extensions to shared project for reuse across test suites
- Consolidated `ActivityTestFixture`, `ActivityTestFixtureExtensions`, and `ActivityTestFixtureHttpExtensions` into `Elsa.Testing.Shared`.
- Updated namespaces and imports across unit tests to reflect new structure.
- Enhanced `AssertActivityAttributes` and added fluent configuration APIs.
- Adjusted `Directory.Packages.props` with new dependencies, including `NSubstitute` and `xunit.assert`.
* Refactor `SetVariableTests`: inline `ActivityTestFixture` initialization to simplify test setup.
* Refactor `ActivityTestFixture`: eliminate redundant field `_services`, add `UsedImplicitly` attributes, and improve service collection management
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add XML documentation for `ActivityExecutionContextExtensions`, detailing methods and parameters.
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add XML documentation for scheduler strategies and their methods
- Updated `IActivityExecutionContextSchedulerStrategy` and `IWorkflowExecutionContextSchedulerStrategy` interfaces with XML summaries for methods.
- Added XML documentation to implementations (`ActivityExecutionContextSchedulerStrategy`, `WorkflowExecutionContextSchedulerStrategy`) and test fakes for clarity.
* Refactor `WriteLineTests`: consolidate duplicate test logic, simplify setup with shared helper method, and enhance readability in assertions.
* Refactor `WriteLineTests` and `SetVariableTests`: replace `WriteLineAsync` assertions with synchronous `WriteLine`, streamline exception recording in `SetVariableTests`, and remove unused imports.
* Add `ParallelTests` for unit and integration testing with various scenarios (#6988)
- Added unit tests for `Parallel` activity to ensure proper scheduling of child activities, including empty and mixed activity cases.
- Added integration tests to validate execution flow and edge cases for `Parallel` activities (e.g., nested parallelism, fault handling).
- Enhanced `ScheduleChildrenAsync` in `Parallel` to handle no activity scenario by completing immediately.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add new unit and integration tests for activity input and expression evaluation (#6990)
* Introduce Scheduler Strategy Interfaces and Implementations for Workflow and Activity Execution Contexts
- Added `IWorkflowExecutionContextSchedulerStrategy` and `IActivityExecutionContextSchedulerStrategy` interfaces.
- Implemented `WorkflowExecutionContextSchedulerStrategy` and `ActivityExecutionContextSchedulerStrategy` for scheduling activities in workflows.
- Refactored scheduling logic to utilize the new scheduler strategies.
- Updated unit tests and test helpers to reflect refactoring, introducing fake implementations for testing purposes.
- Adjusted background execution scheduling and improved extensibility for custom scheduler strategies.
* Refactor `SendHttpRequestTests`: simplify scheduling assertions, use shared extensions, and standardize method naming. Streamline helper methods and remove unused test logic.
* Refactor: Replace `ActivityTestHelper` with `ActivityTestFixture` in unit tests for streamlined activity testing
- Introduced `ActivityTestFixture` with a fluent API for better test setup and execution of activities.
- Added extension methods `ActivityTestFixtureExtensions` and `ActivityTestFixtureHttpExtensions` for configuring attributes and HTTP services.
- Updated test guidelines and unit tests to use the new fixture and extensions.
- Removed `ActivityTestHelper`.
* Refactor: Move `ActivityTestFixture` and related extensions to shared project for reuse across test suites
- Consolidated `ActivityTestFixture`, `ActivityTestFixtureExtensions`, and `ActivityTestFixtureHttpExtensions` into `Elsa.Testing.Shared`.
- Updated namespaces and imports across unit tests to reflect new structure.
- Enhanced `AssertActivityAttributes` and added fluent configuration APIs.
- Adjusted `Directory.Packages.props` with new dependencies, including `NSubstitute` and `xunit.assert`.
* Refactor `SetVariableTests`: inline `ActivityTestFixture` initialization to simplify test setup.
* Refactor `ActivityTestFixture`: eliminate redundant field `_services`, add `UsedImplicitly` attributes, and improve service collection management
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add XML documentation for `ActivityExecutionContextExtensions`, detailing methods and parameters.
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add XML documentation for scheduler strategies and their methods
- Updated `IActivityExecutionContextSchedulerStrategy` and `IWorkflowExecutionContextSchedulerStrategy` interfaces with XML summaries for methods.
- Added XML documentation to implementations (`ActivityExecutionContextSchedulerStrategy`, `WorkflowExecutionContextSchedulerStrategy`) and test fakes for clarity.
* Refactor `WriteLineTests`: consolidate duplicate test logic, simplify setup with shared helper method, and enhance readability in assertions.
* Refactor `WriteLineTests` and `SetVariableTests`: replace `WriteLineAsync` assertions with synchronous `WriteLine`, streamline exception recording in `SetVariableTests`, and remove unused imports.
* Add new unit and integration tests for activity input and expression evaluation
- Introduced comprehensive test suites covering activity input evaluation, expression handling, and fault scenarios.
- Added unit tests for `ExpressionDescriptorRegistry`, `ExpressionEvaluator`, and activity execution context extensions.
- Added integration tests: `CustomInputEvaluatorTests`, `InputEvaluationErrorTests`, and `InputPropertyEvaluationTests`.
- Enhanced code coverage for edge cases and async evaluation logic.
* Remove unused `RunWorkflowAsync` extension method from `RunActivityExtensions`.
* Rename `CustomInputEvaluatorTests` to `InputEvaluationTests` for consistency with naming conventions.
* Remove unused `Elsa.Workflows.Activities` import from `RunActivityExtensions`.
* Remove redundant comments from `InputEvaluationErrorTests` for clarity.
* Refactor unit tests to streamline activity and expression evaluations
- Refactored `ExecuteActivityAsync` and `ExecuteWriteLineAsync` into shared helpers for consistency and reuse across tests.
- Replaced redundant mock setups with helper methods in `ExpressionDescriptorRegistryTests`.
- Simplified test setup for expression and activity evaluation by removing unused imports and consolidating configuration logic.
- Enhanced readability by reducing duplicate code and leveraging shared utility methods.
* Refactor activity input evaluation tests
- Extracted `CreateContextAsync` helper into `EvaluationTestHelpers` for reuse across evaluation test suites.
- Replaced inline activity context setup with shared helper in `InputPropertyEvaluationTests`, `WrappedInputEvaluationTests`, and related test suites.
- Simplified test method names for clarity and consistency.
- Updated test annotations to enhance readability and align with naming conventions.
* Remove redundant test cases and unused imports
- Deleted duplicated and non-essential test cases across evaluation test suites.
- Removed unused imports to improve code cleanliness and readability.
- Streamlined variable initializations and method calls within test setups.
* Remove redundant test case from `InputEvaluationErrorTests`
- Deleted the `ContinuesEvaluationForMultipleInputs` test, as it overlaps with existing tests and does not provide additional coverage.
* Remove redundant assertion from `InputPropertyEvaluationTests`
- Deleted `Assert.True(context.GetHasEvaluatedProperties())`, as it is unnecessary for verifying test outcomes.
* Remove redundant test cases from `WrappedInputEvaluationTests`
- Deleted `UsesDefaultValueWhenInputIsNull` and `EvaluatesExpression` tests as they are either duplicated or unnecessary for current test coverage.
* Add unit test projects for `Elsa.Workflows.Management` and `Elsa.Expressions`
- Introduced new test projects to separate and organize unit tests for `Elsa.Workflows.Management` and `Elsa.Expressions`.
- Updated `Elsa.sln` to include references to the newly added test projects.
- Adjusted namespaces in affected test classes for consistency with the updated project structure.
* Refactor `ExpressionEvaluatorTests` for clarity and consistency
- Simplified test method names and annotations for improved readability.
- Replaced duplicate mock setups with helper functions (`CreateContextAsync`, `CreateContextWithMockHandlerAsync`, and related methods).
- Streamlined test setups by removing redundant code and consolidating context creation logic.
- Updated test annotations to include descriptive `DisplayName` attributes.
* Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Remove redundant comment from `ExpressionEvaluatorTests` for clarity
* Remove redundant blank lines from unit test classes
- Eliminated unnecessary blank lines across `ActivityExecutionContextExtensions` test suites to improve code readability and consistency.
* Update src/modules/Elsa.Expressions/Services/ExpressionEvaluator.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Expand `test-guidelines.md` with testing best practices, helper references, and example snippets
- Added detailed guidance on test project organization, updated helper documentation, and streamlined example code for activity unit testing.
- Introduced scheduler strategy information and integration test patterns for deterministic tests.
- Clarified usage of shared infrastructure like `ActivityTestFixture` and `AsyncWorkflowRunner`.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Fix merge issue
---------
Co-authored-by: lucas.hipolito <lukhipolito@yahoo.com.br>
Co-authored-by: lukhipolito-nexxbiz <lucas.hipolito@nexxbiz.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>