Example #1
0
        public void RestoreAndResume()
        {
            // Arrange
            var workplan = WorkplanDummy.CreatePausable();
            var engine   = Workflow.CreateEngine(workplan, new NullContext());
            var stepId   = workplan.Steps.Single(s => s is PausableStep).Id;
            var snapShot = new WorkflowSnapshot
            {
                Holders = new[]
                {
                    new HolderSnapshot
                    {
                        HolderId = stepId,
                        Tokens   = new IToken[] { new MainToken() }
                    }
                }
            };

            // Act
            engine.Restore(snapShot);
            engine.Completed           += EngineCompleted;
            engine.TransitionTriggered += (sender, transition) => { };
            engine.Start(); // <-- This run to the end

            // Assert
            Assert.IsTrue(_completed);
        }
Example #2
0
 internal override void Restore(WorkflowSnapshot snapshot)
 {
     NextState(StateRestored);
     Context.CurrentSnapshot = snapshot;
     Context.ExecuteRestore();
 }