public void RegisterWorkflow_SingleInstanceWorkflowRegistered_ThrowsExceptionIfAlreadyExists() { // set up the store and the workflows IWorkflowStore workflowStore = new MemoryWorkflowStore(); workflowStore.Save(new SingleInstanceWorkflow(SingleInstanceWorkflow.State.Start)); SingleInstanceWorkflow workflow = new SingleInstanceWorkflow(SingleInstanceWorkflow.State.Start); IWorkflowRegistrationService regService = new WorkflowRegistrationService(); regService.RegisterWorkflow(workflowStore, workflow); }
public void RegisterWorkflow_SingleInstanceWorkflowRegistered_ThrowsExceptionIfAlreadyExists() { // set up the store and the workflows IWorkflowStore workflowStore = new MemoryWorkflowStore(); workflowStore.Save(new SingleInstanceWorkflow(SingleInstanceWorkflow.State.Start)); SingleInstanceWorkflow workflow = new SingleInstanceWorkflow(SingleInstanceWorkflow.State.Start); IWorkflowRegistrationService regService = new WorkflowRegistrationService(); TestDelegate del = () => regService.RegisterWorkflow(workflowStore, workflow); Assert.Throws <SingleInstanceWorkflowAlreadyExistsException>(del); }
public void RegisterWorkflow_SingleInstanceWorkflowRegistered_RegistersIfDoesNotAlreadyExist() { // set up the store and the workflows IWorkflowStore workflowStore = Substitute.For <IWorkflowStore>(); workflowStore.GetAllByType(Arg.Any <string>()).Returns(new List <Workflow>()); SingleInstanceWorkflow workflow = new SingleInstanceWorkflow(SingleInstanceWorkflow.State.Start); IWorkflowRegistrationService regService = new WorkflowRegistrationService(); regService.RegisterWorkflow(workflowStore, workflow); workflowStore.Received(1).GetAllByType(workflow.GetType().AssemblyQualifiedName); }
public void RegisterWorkflow_SingleInstanceWorkflowRegistered_RegistersIfDoesNotAlreadyExist() { // set up the store and the workflows IWorkflowStore workflowStore = Substitute.For<IWorkflowStore>(); workflowStore.GetAllByType(Arg.Any<string>()).Returns(new List<Workflow>()); SingleInstanceWorkflow workflow = new SingleInstanceWorkflow(SingleInstanceWorkflow.State.Start); IWorkflowRegistrationService regService = new WorkflowRegistrationService(); regService.RegisterWorkflow(workflowStore, workflow); workflowStore.Received(1).GetAllByType(workflow.GetType().AssemblyQualifiedName); }