elsa-core/test/unit
j03y-nxxbz 48b574a411
Added logic to search for workflow-as-activities based on DefinitionId (not only versionId) (#7149)
* Inital commit:

1. Fixed problem: (re-)added logic to search for workflow-as-activities based on DefinitionId (not only versionId)

2. Added tests for Deserialiazation so this logic cannot disappear "unnoticed" in the future.

* Found one flaw:
workflowDefinitionId is also used in other activities. Therefore, we must make sure to only search by workflowDefinitionId when the value is a string (e.g. when workflow used as activity, the value will always be a constant string, because the workflowDefinitionId cannot be resolved using expressions)

* Final attempt:
1) First try to find the activity by type name
2) Even if a descriptor is found by its type name, there might be multiple versions of a workflow-as-activity, hence; if the workflowDefinitionVersionId is specified, then this can override the initially found activity descriptor by type name.
3) Lastly, only when no activity descriptor is found by type name AND the activity JSON contains the property "workflowDeftinitionId", then we can search by workflowDefinitionId

* Add `net8.0` and `net9.0` targets, update package versions for resilience libraries.

* Exclude `net10.0` target framework from MySQL EF Core project due to Pomelo compatibility constraints.

* Remove unnecessary whitespace in MySQL EF Core project file

* Refactor `ActivityJsonConverterTests` to streamline registry setup and improve readability.

* Adds null activity descriptor lookup mock

Ensures the custom property lookup path is tested by mocking type name lookups to return null when searching for ActivityDescriptors.

* Fix activity descriptor override assignment in `ActivityJsonConverter`

Corrects the assignment logic for `activityDescriptor` and ensures `activityTypeVersion` uses the overridden descriptor's version when a custom property match is found.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor `ActivityJsonConverter` for readability and logic improvements

- Adjust null-check handling for `activityDescriptor` overrides.
- Improve comment clarity and consolidate lambda expressions.
- Remove unnecessary whitespace.

* Add blob extension handling to `BlobStorageWorkflowsProvider`

- Introduce `BlobExtensions` for extracting blob file extensions.
- Add `SupportsExtension` to `IBlobWorkflowFormatHandler` to filter handlers by supported extensions.

* Remove unused workflow files and references in `Elsa.Server.Web`

- Deleted `flowchart-test.elsa` and `multi-workflow-example.elsa`.
- Removed corresponding references from the project file.

---------

Co-authored-by: Joey Barten - Founder Orbyss <joey.barten@unfussiness.io>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-17 23:23:49 +01:00
..
Elsa.Activities.UnitTests Configures Flowchart Execution via DI (#7141) 2025-12-15 10:15:39 +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 Elsa Script DSL (#7076) 2025-11-25 19:57:50 +01:00
Elsa.Scheduling.UnitTests Add Elsa Script DSL (#7076) 2025-11-25 19:57:50 +01:00
Elsa.Workflows.Core.UnitTests Added logic to search for workflow-as-activities based on DefinitionId (not only versionId) (#7149) 2025-12-17 23:23:49 +01:00
Elsa.Workflows.Management.UnitTests Add code coverage configuration and adjust test projects (#7049) 2025-11-12 13:59:36 +01:00
Elsa.Workflows.Runtime.UnitTests Add code coverage configuration and adjust test projects (#7049) 2025-11-12 13:59:36 +01:00
Directory.Build.props Add coverage enforcement for test projects (#6950) 2025-10-07 19:59:53 +02:00