Add project files.
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
using Elsa.Workflows.ComponentTests.Abstractions;
|
||||
using Elsa.Workflows.ComponentTests.Fixtures;
|
||||
using Elsa.Workflows.Management;
|
||||
using Elsa.Workflows.Runtime;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Elsa.Workflows.ComponentTests.Scenarios.InputOutput;
|
||||
|
||||
public class InputOutputTests(App app) : AppComponentTest(app)
|
||||
{
|
||||
[Fact(DisplayName = "Input should be received by the Provider and should in turn be able to send it back to the Consumer.")]
|
||||
public async Task InputShouldBeOutput()
|
||||
{
|
||||
const string workflowDefinitionVersionId = "4e993ab1b3d4e4a1";
|
||||
var workflowDefinitionService = Scope.ServiceProvider.GetRequiredService<IWorkflowDefinitionService>();
|
||||
var workflowInvoker = Scope.ServiceProvider.GetRequiredService<IWorkflowInvoker>();
|
||||
var variableManager = Scope.ServiceProvider.GetRequiredService<IWorkflowInstanceVariableManager>();
|
||||
var workflowGraph = await workflowDefinitionService.FindWorkflowGraphAsync(workflowDefinitionVersionId);
|
||||
var result = await workflowInvoker.InvokeAsync(workflowGraph!);
|
||||
var variables = await variableManager.GetVariablesAsync(result.WorkflowState.Id);
|
||||
var variableValue = variables.First().Value;
|
||||
|
||||
Assert.Equal("Hello World!", variableValue);
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"$schema": "https://elsaworkflows.io/schemas/workflow-definition/v3.0.0/schema.json",
|
||||
"id": "4e993ab1b3d4e4a1",
|
||||
"definitionId": "58dbd7bffa85a761",
|
||||
"name": "Consumer",
|
||||
"createdAt": "2024-12-04T16:49:20.593932\u002B00:00",
|
||||
"version": 1,
|
||||
"toolVersion": "3.3.0.0",
|
||||
"variables": [
|
||||
{
|
||||
"id": "67fcb9870af4c28e",
|
||||
"name": "Variable1",
|
||||
"typeName": "String",
|
||||
"isArray": false,
|
||||
"value": "",
|
||||
"storageDriverTypeName": "Elsa.Workflows.WorkflowInstanceStorageDriver, Elsa.Workflows.Core"
|
||||
}
|
||||
],
|
||||
"inputs": [],
|
||||
"outputs": [],
|
||||
"outcomes": [],
|
||||
"customProperties": {
|
||||
"logPersistenceConfig": {
|
||||
"default": {
|
||||
"evaluationMode": "Strategy",
|
||||
"strategyType": "Elsa.Workflows.LogPersistence.Strategies.Inherit, Elsa.Workflows.Core",
|
||||
"expression": null
|
||||
}
|
||||
}
|
||||
},
|
||||
"isReadonly": false,
|
||||
"isSystem": false,
|
||||
"isLatest": true,
|
||||
"isPublished": true,
|
||||
"options": {
|
||||
"autoUpdateConsumingWorkflows": false
|
||||
},
|
||||
"root": {
|
||||
"id": "938f2c91bb759a6a",
|
||||
"nodeId": "Workflow2:938f2c91bb759a6a",
|
||||
"name": "Flowchart1",
|
||||
"type": "Elsa.Flowchart",
|
||||
"version": 1,
|
||||
"customProperties": {
|
||||
"notFoundConnections": [],
|
||||
"canStartWorkflow": false,
|
||||
"runAsynchronously": false
|
||||
},
|
||||
"metadata": {},
|
||||
"activities": [
|
||||
{
|
||||
"workflowDefinitionId": "780fbf96f1bb1e7e",
|
||||
"workflowDefinitionVersionId": "640867552fc865d",
|
||||
"latestAvailablePublishedVersion": 3,
|
||||
"latestAvailablePublishedVersionId": "640867552fc865d",
|
||||
"id": "8c1127e1193cd6e8",
|
||||
"nodeId": "Workflow2:938f2c91bb759a6a:8c1127e1193cd6e8",
|
||||
"name": "Output1",
|
||||
"type": "Provider",
|
||||
"version": 1,
|
||||
"customProperties": {
|
||||
"canStartWorkflow": false,
|
||||
"runAsynchronously": false
|
||||
},
|
||||
"metadata": {
|
||||
"designer": {
|
||||
"position": {
|
||||
"x": -160,
|
||||
"y": -280
|
||||
},
|
||||
"size": {
|
||||
"width": 89.6953125,
|
||||
"height": 50
|
||||
}
|
||||
}
|
||||
},
|
||||
"input1": {
|
||||
"typeName": "Object",
|
||||
"expression": {
|
||||
"type": "Literal",
|
||||
"value": "Hello World!"
|
||||
},
|
||||
"memoryReference": {
|
||||
"id": "8c1127e1193cd6e8:input-input-1"
|
||||
}
|
||||
},
|
||||
"output1": {
|
||||
"typeName": "Object",
|
||||
"memoryReference": {
|
||||
"id": "67fcb9870af4c28e"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"variables": [],
|
||||
"connections": []
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"$schema": "https://elsaworkflows.io/schemas/workflow-definition/v3.0.0/schema.json",
|
||||
"id": "5ba5a7e36d60549b",
|
||||
"definitionId": "780fbf96f1bb1e7e",
|
||||
"name": "Provider",
|
||||
"createdAt": "2024-12-04T16:22:39.064075\u002B00:00",
|
||||
"version": 1,
|
||||
"toolVersion": "3.3.0.0",
|
||||
"variables": [],
|
||||
"inputs": [
|
||||
{
|
||||
"uiHint": "singleline",
|
||||
"storageDriverType": "Elsa.Workflows.WorkflowInstanceStorageDriver, Elsa.Workflows.Core",
|
||||
"type": "Object",
|
||||
"name": "Input1",
|
||||
"displayName": "Input 1",
|
||||
"description": "",
|
||||
"category": "Primitives",
|
||||
"isArray": false
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"type": "Object",
|
||||
"name": "Output1",
|
||||
"displayName": "Output 1",
|
||||
"description": "",
|
||||
"category": "Primitives",
|
||||
"isArray": false
|
||||
}
|
||||
],
|
||||
"outcomes": [],
|
||||
"customProperties": {
|
||||
"logPersistenceConfig": {
|
||||
"default": {
|
||||
"evaluationMode": "Strategy",
|
||||
"strategyType": "Elsa.Workflows.LogPersistence.Strategies.Inherit, Elsa.Workflows.Core",
|
||||
"expression": null
|
||||
}
|
||||
}
|
||||
},
|
||||
"isReadonly": false,
|
||||
"isSystem": false,
|
||||
"isLatest": true,
|
||||
"isPublished": false,
|
||||
"options": {
|
||||
"usableAsActivity": true,
|
||||
"autoUpdateConsumingWorkflows": true
|
||||
},
|
||||
"root": {
|
||||
"id": "85a5e1d9e487bfa4",
|
||||
"nodeId": "Workflow1:85a5e1d9e487bfa4",
|
||||
"name": "Flowchart1",
|
||||
"type": "Elsa.Flowchart",
|
||||
"version": 1,
|
||||
"customProperties": {
|
||||
"notFoundConnections": [],
|
||||
"canStartWorkflow": false,
|
||||
"runAsynchronously": false
|
||||
},
|
||||
"metadata": {},
|
||||
"activities": [
|
||||
{
|
||||
"outputName": {
|
||||
"typeName": "String",
|
||||
"expression": {
|
||||
"type": "Literal",
|
||||
"value": "Output1"
|
||||
}
|
||||
},
|
||||
"outputValue": {
|
||||
"typeName": "Object",
|
||||
"expression": {
|
||||
"type": "JavaScript",
|
||||
"value": "return getInput1()"
|
||||
}
|
||||
},
|
||||
"id": "985eb3bfb8d4dd3f",
|
||||
"nodeId": "Workflow1:85a5e1d9e487bfa4:985eb3bfb8d4dd3f",
|
||||
"name": "SetOutput1",
|
||||
"type": "Elsa.SetOutput",
|
||||
"version": 1,
|
||||
"customProperties": {
|
||||
"canStartWorkflow": false,
|
||||
"runAsynchronously": false
|
||||
},
|
||||
"metadata": {
|
||||
"designer": {
|
||||
"position": {
|
||||
"x": -380,
|
||||
"y": -220
|
||||
},
|
||||
"size": {
|
||||
"width": 107.3203125,
|
||||
"height": 50
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"variables": [],
|
||||
"connections": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user