danielgerlag / workflow-core

Lightweight workflow engine for .NET Standard
MIT License
5.4k stars 1.2k forks source link

System.TypeLoadException: 'Could not load type 'WorkflowCore.Primitives.Sequence' from assembly 'WorkflowCore.TestAssets'.' when running unit test with Json Saga definition #1312

Closed martin-jeremic closed 4 weeks ago

martin-jeremic commented 4 weeks ago

I'm trying to implement saga rollback in case of failure of workflow step, but i have several problems, starting with this one. In order to learn how this lib actually works, i pulled repo from github, changed content of stored-definition.json file to include saga sample from documentation (see json below) and tried to run " [Fact(DisplayName = "Should parse definition")]" unit test from DefinitionLoaderTests.cs class.

Test is failing with error System.TypeLoadException: 'Could not load type 'WorkflowCore.Primitives.Sequence' from assembly 'WorkflowCore.TestAssets'.'

To Reproduce

{
  "Id": "Saga-Sample",
  "Version": 1,
  "DataType": "WorkflowCore.TestAssets.DataTypes.CounterBoard, WorkflowCore.TestAssets",
  "Steps": [
    {
      "Id": "Hello",
      "StepType": "WorkflowCore.TestAssets.Steps.Counter, WorkflowCore.TestAssets",
      "NextStepId": "MySaga"
    },
    {
      "Id": "MySaga",
      "StepType": "WorkflowCore.Primitives.Sequence, WorkflowCore.TestAssets",
      "NextStepId": "Bye",
      "Saga": true,
      "Do": [
        [
          {
            "Id": "Step3",
            "StepType": "WorkflowCore.Primitives.If, WorkflowCore",
            "NextStepId": "Step4",
            "Inputs": { "Condition": "data.Flag1" },
            "CompensateWith": [
              {
                "Id": "Step3.1.2",
                "StepType": "WorkflowCore.TestAssets.Steps.Counter, WorkflowCore.TestAssets"
              }
            ]
          }
        ]
        ]

    },
    {
      "Id": "Step4",
      "NextStepId": "decide",
      "StepType": "WorkflowCore.TestAssets.Steps.Counter, WorkflowCore.TestAssets",
      "Inputs": { "Value": "data.Counter6" },
      "Outputs": { "Counter6": "step.Value" }
    }
  ]
}
danielgerlag commented 4 weeks ago

change "StepType": "WorkflowCore.Primitives.Sequence, WorkflowCore.TestAssets", to "StepType": "WorkflowCore.Primitives.Sequence, WorkflowCore",