public void CreateWithSingleActivity() { var passed = false; var model = ProcessModel.CreateWithSingleActivity( LambdaActivity.Create(() => passed = true) ); var instance = ProcessInstance.Create(model); var context = new ExecutionContext(null, model, instance, instance.Token, null); instance.HandleEvent(context, new object()); passed.Should().BeTrue(); }
public void ThrowInvalidOperationExceptionWhenNonExistentModelIdIsInformedToHandleActivityCompletion() { var model = ProcessModel.CreateWithSingleActivity( new UserActivity() ); var models = new InMemoryProcessModelsStore(model); var instances = new InMemoryProcessInstancesStore(); var manager = new ProcessManager(models, instances); var result = manager.HandleEvent(null).First(); var manager2 = new ProcessManager( new InMemoryProcessModelsStore(), instances ); Action sut = () => manager2.HandleActivityCompletion(result.ProcessInstanceId, Guid.NewGuid(), null); sut.Should().Throw <InvalidOperationException>(); }