elsa-core/test/component/Elsa.Workflows.ComponentTests
Sipke Schoorstra 0422435be9
Fix workflow variable scope inconsistency (#5558)
* Refactor variable handling in ExpressionExecutionContextExtensions

The core change in this commit is the refactoring of the handling of variables within the ExpressionExecutionContextExtensions. The methods GetVariable, CreateVariable, and GetVariableBlock have been altered for clarity and simplified reducing redundant code. Unnecessary parameters and returns in method documentation have been removed, and overall code formatting has been improved to enhance readability.

* Simplify MemoryRegister creation in Workflow.cs

The creation of the MemoryRegister object in the file Workflow.cs was simplified to one line. The previous method, which declared a new object then called the Declare method before returning, was removed.

* Map controller routes in server web program

Added a line of code in the Elsa.Server.Web program.cs file to map controller routes. This change ensures that HTTP requests are correctly directed to their corresponding controller actions.

* Update workflow state extraction logic

The logic in the WorkflowStateExtractor has been updated to retain the root Workflow activity context even if it's completed. This change is necessary to keep workflow-level variables accessible.

* Remove RequiresUnreferencedCode attribute from ConvertTo method

The RequiresUnreferencedCode attribute was removed from the ConvertTo method in the ObjectConverter class.

* Remove unused services and rename test file

Unused services in the AutoUpdateTests.cs class were removed, reducing clutter and improving code readability. Additionally, the DeleteWorkflow_Clustered.cs test file has been renamed to DeleteWorkflowClustered.cs for better naming consistency.

* Add CountdownStep activity and CountdownWorkflow for testing

This commit introduces new component tests for simulations involving counters. It includes a new CountdownStep activity that decrements a counter variable, as well as a CountdownWorkflow which consists of a loop based on the aforementioned activity. It also involves a CountdownWorkflowTests class for testing counter persistence across workflow runs.

* Remove unnecessary whitespace in CountdownWorkflowTests

This commit eliminates the superfluous whitespace in the CountdownWorkflowTests.cs file. It maintains the proper formatting and ensures code consistency across the test component.

* Refactor CountdownWorkflowTests constructor

Simplified the constructor of the CountdownWorkflowTests class. The changes remove the unnecessary constructor body and pass the 'app' object directly to the base AppComponentTest class, enhancing the code's readability and maintainability.

* Add application roles and configure them in MassTransit

A new enum ApplicationRole has been added for distinguishing among different roles (Hybrid, Api, Worker) an application can take. In the configuration of MassTransit, it is now possible to disable the consumers based on application role, which can help optimize the usage of resources and increase application efficiency.

* Update Program.cs

Switch to Memory broker

* Update Program.cs

Simplify DisableConsumers assignment.

* Update ApplicationRole.cs

Rename Hybrid to Default.

* Update appsettings.json
2024-06-10 10:51:23 +02:00
..
Helpers Merge branch 'patch/alpha' 2024-06-07 18:01:09 +02:00
Scenarios Fix workflow variable scope inconsistency (#5558) 2024-06-10 10:51:23 +02:00
Elsa.Workflows.ComponentTests.csproj Add HTTP cache invalidation on auto-update of consuming workflows 2024-06-07 14:01:14 +02:00
Elsa.Workflows.ComponentTests.csproj.DotSettings Add Component Testing Framework (#5261) 2024-04-26 15:49:14 +02:00
xunit.runner.json Add Component Testing Framework (#5261) 2024-04-26 15:49:14 +02:00