public FuncTask <WorkflowResult> CreateWorkflow(object wfAddIn, IWorkflowDataEntity wfData) { FuncTask <WorkflowResult> task = new FuncTask <WorkflowResult>(); WorkflowResult wfResult = this.GetFlowID(wfAddIn); if (wfResult.FlowID == Guid.Empty) { task.Complete(wfResult); } else { IWorkflowService service = ServiceContainer.GetService <IWorkflowService>(task); service.CreateWorkflow(wfResult.FlowID, wfData, ContextHelper.Account.LoginID); } return(task); }
public void CreateWorkflow_Service_Fail() { // Arrange workflowService = new WorkflowService(mockRepository.Object, mockLogger.Object, mockCache.Object, mockTelemetry.Object); mockRepository.Setup(x => x.Insert(It.IsAny <Workflow>())).Returns(false).Verifiable(); // Act var workflow = new WorkflowDto(); var response = workflowService.CreateWorkflow(workflow); // Assert Assert.IsNotNull(response); Assert.IsFalse(response.Result); Assert.IsTrue(response.Notifications.HasErrors()); Assert.IsInstanceOfType(response, typeof(GenericServiceResponse <bool>)); mockRepository.Verify(x => x.Insert(It.IsAny <Workflow>()), Times.Once); }
public async Task <HttpResponseMessage> CreateWorkflow([FromBody] CreateWorkflowDto createWorkflowDto) { await _privilegesManager.Demand(Session.UserId, InstanceAdminPrivileges.AccessAllProjectData); if (createWorkflowDto != null) { createWorkflowDto.Name = createWorkflowDto.Name?.Trim() ?? createWorkflowDto.Name; createWorkflowDto.Description = createWorkflowDto.Description?.Trim() ?? createWorkflowDto.Description; } else { throw new BadRequestException(ErrorMessages.CreateWorkfloModelIsEmpty, ErrorCodes.BadRequest); } createWorkflowDto.Validate(); var result = await _workflowService.CreateWorkflow(createWorkflowDto.Name, createWorkflowDto.Description, Session.UserId); return(Request.CreateResponse(HttpStatusCode.Created, result)); }
public async Task <WorkflowDetails> CreateWorkflow([FromBody] WorkflowStructure data) { logger.LogInformation("Creating new workflow"); return(await workflowservice.GetWorkflow(await workflowservice.CreateWorkflow(data))); }
public async Task CreateWorkflow(WorkflowInput input) { await _workflowService.CreateWorkflow(input); }