using Elsa.Workflows.Activities; using Elsa.Workflows.Management.Entities; using Elsa.Workflows.Models; namespace Elsa.Workflows.Management.UnitTests.Helpers; /// /// Provides helper methods for creating test data in Workflow Management unit tests. /// public static class TestHelpers { /// /// Creates a workflow definition with the specified parameters. /// public static WorkflowDefinition CreateWorkflowDefinition(string definitionId, string materializerName) { return new WorkflowDefinition { DefinitionId = definitionId, MaterializerName = materializerName, Version = 1 }; } /// /// Creates a workflow graph from a workflow, ensuring proper initialization. /// public static WorkflowGraph CreateWorkflowGraph(Workflow workflow) { // Ensure the workflow has a proper root activity with an ID var rootActivity = new Sequence { Id = "Root" }; workflow.Root = rootActivity; // Create an ActivityNode with the root activity var rootNode = new ActivityNode(rootActivity, "Root"); // Create and return the WorkflowGraph return new WorkflowGraph(workflow, rootNode, new[] { rootNode }); } }