|
8 | 8 |
|
9 | 9 | namespace WorkflowCore.IntegrationTests.Scenarios
|
10 | 10 | {
|
11 |
| - //public class EndStepScenario : BaseScenario<EndStepScenario.ScenarioWorkflow, Object> |
12 |
| - //{ |
13 |
| - // internal static int StartStepCounter = 0; |
14 |
| - // internal static int MidStepCounter = 0; |
15 |
| - // internal static int EndStepCounter = 0; |
| 11 | + public class EndStepScenario : BaseScenario<EndStepScenario.ScenarioWorkflow, Object> |
| 12 | + { |
| 13 | + internal static int StartStepCounter = 0; |
| 14 | + internal static int MidStepCounter = 0; |
| 15 | + internal static int EndStepCounter = 0; |
16 | 16 |
|
17 |
| - // public class ScenarioWorkflow : IWorkflow |
18 |
| - // { |
19 |
| - // public string Id => "EndStepScenario"; |
20 |
| - // public int Version => 1; |
21 |
| - // public void Build(IWorkflowBuilder<Object> builder) |
22 |
| - // { |
23 |
| - // builder |
24 |
| - // .StartWith(context => |
25 |
| - // { |
26 |
| - // StartStepCounter++; |
27 |
| - // return ExecutionResult.Next(); |
28 |
| - // }) |
29 |
| - // .While(x => true) |
30 |
| - // .Do(x => x |
31 |
| - // .StartWith(context => |
32 |
| - // { |
33 |
| - // MidStepCounter++; |
34 |
| - // return ExecutionResult.Next(); |
35 |
| - // })) |
36 |
| - // .EndWorkflow() |
37 |
| - // .Then(context => |
38 |
| - // { |
39 |
| - // EndStepCounter++; |
40 |
| - // return ExecutionResult.Next(); |
41 |
| - // }); |
42 |
| - // } |
43 |
| - // } |
| 17 | + public class ScenarioWorkflow : IWorkflow |
| 18 | + { |
| 19 | + public string Id => "EndStepScenario"; |
| 20 | + public int Version => 1; |
| 21 | + public void Build(IWorkflowBuilder<Object> builder) |
| 22 | + { |
| 23 | + builder |
| 24 | + .StartWith(context => |
| 25 | + { |
| 26 | + StartStepCounter++; |
| 27 | + return ExecutionResult.Next(); |
| 28 | + }) |
| 29 | + .While(x => true) |
| 30 | + .Do(x => x |
| 31 | + .StartWith(context => |
| 32 | + { |
| 33 | + MidStepCounter++; |
| 34 | + return ExecutionResult.Next(); |
| 35 | + }) |
| 36 | + .EndWorkflow()) |
| 37 | + .Then(context => |
| 38 | + { |
| 39 | + EndStepCounter++; |
| 40 | + return ExecutionResult.Next(); |
| 41 | + }); |
| 42 | + } |
| 43 | + } |
44 | 44 |
|
45 |
| - // [Fact] |
46 |
| - // public void Scenario() |
47 |
| - // { |
48 |
| - // var workflowId = Host.StartWorkflow("EndStepScenario").Result; |
49 |
| - // var instance = PersistenceProvider.GetWorkflowInstance(workflowId).Result; |
50 |
| - // int counter = 0; |
51 |
| - // while ((instance.Status == WorkflowStatus.Runnable) && (counter < 300)) |
52 |
| - // { |
53 |
| - // System.Threading.Thread.Sleep(100); |
54 |
| - // counter++; |
55 |
| - // instance = PersistenceProvider.GetWorkflowInstance(workflowId).Result; |
56 |
| - // } |
| 45 | + [Fact] |
| 46 | + public void Scenario() |
| 47 | + { |
| 48 | + var workflowId = Host.StartWorkflow("EndStepScenario").Result; |
| 49 | + var instance = PersistenceProvider.GetWorkflowInstance(workflowId).Result; |
| 50 | + int counter = 0; |
| 51 | + while ((instance.Status == WorkflowStatus.Runnable) && (counter < 300)) |
| 52 | + { |
| 53 | + System.Threading.Thread.Sleep(100); |
| 54 | + counter++; |
| 55 | + instance = PersistenceProvider.GetWorkflowInstance(workflowId).Result; |
| 56 | + } |
57 | 57 |
|
58 |
| - // instance.Status.Should().Be(WorkflowStatus.Complete); |
59 |
| - // StartStepCounter.Should().Be(1); |
60 |
| - // MidStepCounter.Should().Be(1); |
61 |
| - // EndStepCounter.Should().Be(0); |
62 |
| - // } |
63 |
| - //} |
| 58 | + instance.Status.Should().Be(WorkflowStatus.Complete); |
| 59 | + StartStepCounter.Should().Be(1); |
| 60 | + MidStepCounter.Should().Be(1); |
| 61 | + EndStepCounter.Should().Be(0); |
| 62 | + } |
| 63 | + } |
64 | 64 | }
|
0 commit comments