File tree Expand file tree Collapse file tree 5 files changed +85
-0
lines changed
WorkflowCore.UnitTests/Services/DefinitionStorage Expand file tree Collapse file tree 5 files changed +85
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace WorkflowCore . TestAssets . DataTypes
4+ {
5+ public class CounterBoardWithDynamicData : CounterBoard
6+ {
7+ public DynamicData DynamicDataInstance { get ; set ; }
8+ }
9+ }
Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ public static string GetTestDefinitionDynamicJson()
3030 {
3131 return File . ReadAllText ( "stored-dynamic-definition.json" ) ;
3232 }
33+ public static string GetTestDefinitionDynamicYaml ( )
34+ {
35+ return File . ReadAllText ( "stored-dynamic-definition.yaml" ) ;
36+ }
3337
3438 public static string GetTestDefinitionJsonMissingInputProperty ( )
3539 {
Original file line number Diff line number Diff line change 1313 <None Remove =" stored-definition.json" />
1414 <None Remove =" stored-definition.yaml" />
1515 <None Remove =" stored-dynamic-definition.json" />
16+ <None Remove =" stored-dynamic-definition.yaml" />
1617 </ItemGroup >
1718
1819 <ItemGroup >
20+ <EmbeddedResource Include =" stored-dynamic-definition.yaml" >
21+ <CopyToOutputDirectory >Always</CopyToOutputDirectory >
22+ </EmbeddedResource >
1923 <EmbeddedResource Include =" stored-definition.yaml" >
2024 <CopyToOutputDirectory >Always</CopyToOutputDirectory >
2125 </EmbeddedResource >
Original file line number Diff line number Diff line change 1+ Id : Test
2+ Version : 1
3+ DataType : WorkflowCore.TestAssets.DataTypes.CounterBoardWithDynamicData, WorkflowCore.TestAssets
4+ Steps :
5+ - Id : Step1
6+ StepType : WorkflowCore.TestAssets.Steps.Counter, WorkflowCore.TestAssets
7+ ErrorBehavior : Retry
8+ Inputs :
9+ Value : data.DynamicDataInstance["test"]
10+ Outputs :
11+ DynamicDataInstance["test"] : step.Value
12+ NextStepId : Step2
13+ - Id : Step2
14+ StepType : WorkflowCore.TestAssets.Steps.Counter, WorkflowCore.TestAssets
15+ Inputs :
16+ Value : data.Counter2
17+ Outputs :
18+ Counter2 : step.Value
19+ NextStepId : Step3
20+ - Id : Step3
21+ StepType : WorkflowCore.Primitives.If, WorkflowCore
22+ NextStepId : Step4
23+ Inputs :
24+ Condition : object.Equals(data.Flag1, true)
25+ Do :
26+ - - Id : Step3.1.1
27+ StepType : WorkflowCore.TestAssets.Steps.Counter, WorkflowCore.TestAssets
28+ Inputs :
29+ Value : data.Counter3
30+ Outputs :
31+ Counter3 : step.Value
32+ NextStepId : Step3.1.2
33+ - Id : Step3.1.2
34+ StepType : WorkflowCore.TestAssets.Steps.Counter, WorkflowCore.TestAssets
35+ Inputs :
36+ Value : data.Counter4
37+ Outputs :
38+ Counter4 : step.Value
39+ - - Id : Step3.2.1
40+ StepType : WorkflowCore.Primitives.WaitFor, WorkflowCore
41+ NextStepId : Step3.2.2
42+ CancelCondition : data.Flag2
43+ Inputs :
44+ EventName : ' "Event1"'
45+ EventKey : ' "Key1"'
46+ EffectiveDate : DateTime.Now
47+ - Id : Step3.2.2
48+ StepType : WorkflowCore.TestAssets.Steps.Counter, WorkflowCore.TestAssets
49+ Inputs :
50+ Value : data.Counter5
51+ Outputs :
52+ Counter5 : step.Value
53+ - Id : Step4
54+ StepType : WorkflowCore.TestAssets.Steps.Counter, WorkflowCore.TestAssets
55+ Inputs :
56+ Value : data.Counter6
57+ Outputs :
58+ Counter6 : step.Value
Original file line number Diff line number Diff line change @@ -43,6 +43,16 @@ public void ParseDefinition()
4343 A . CallTo ( ( ) => _registry . RegisterWorkflow ( A < WorkflowDefinition > . That . Matches ( MatchTestDefinition , "" ) ) ) . MustHaveHappened ( ) ;
4444 }
4545
46+ [ Fact ( DisplayName = "Should parse definition" ) ]
47+ public void ParseDefinitionPropertyDynamic ( )
48+ {
49+ _subject . LoadDefinition ( TestAssets . Utils . GetTestDefinitionDynamicYaml ( ) , Deserializers . Yaml ) ;
50+
51+ A . CallTo ( ( ) => _registry . RegisterWorkflow ( A < WorkflowDefinition > . That . Matches ( x => x . Id == "Test" ) ) ) . MustHaveHappened ( ) ;
52+ A . CallTo ( ( ) => _registry . RegisterWorkflow ( A < WorkflowDefinition > . That . Matches ( x => x . Version == 1 ) ) ) . MustHaveHappened ( ) ;
53+ A . CallTo ( ( ) => _registry . RegisterWorkflow ( A < WorkflowDefinition > . That . Matches ( x => x . DataType == typeof ( CounterBoardWithDynamicData ) ) ) ) . MustHaveHappened ( ) ;
54+ A . CallTo ( ( ) => _registry . RegisterWorkflow ( A < WorkflowDefinition > . That . Matches ( MatchTestDefinition , "" ) ) ) . MustHaveHappened ( ) ;
55+ }
4656
4757 [ Fact ( DisplayName = "Should parse definition" ) ]
4858 public void ParseDefinitionDynamic ( )
You can’t perform that action at this time.
0 commit comments