Exemplo n.º 1
0
        private static bool ProcessChoice()
        {
            string input = Console.ReadLine();

            switch (input)
            {
            case "1":
                ListWorkflow listwf = new ListWorkflow();
                listwf.Exe();
                break;

            case "2":
                AddWorkflow addwf = new AddWorkflow();
                addwf.Exe();
                break;

            case "3":
                UpdateWorkflow UWF = new UpdateWorkflow();
                UWF.Exe();
                break;

            case "4":
                DeleteWorkflow DWF = new DeleteWorkflow();
                DWF.Exe();
                break;

            default:
                Console.WriteLine("This is not a valid choice. Press any key to continue...");
                Console.ReadKey();
                break;
            }
            return(true);
        }
        public void DeleteWorkflow_Action_Fails()
        {
            // Arrange
            var workflowDto = TestHelper.WorkflowDto();

            GenericServiceResponse <bool> fakeResponse = null;

            mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable();
            mockClientServicesProvider.Setup(x => x.WorkflowService.DeleteWorkflow(workflowDto)).Returns(fakeResponse).Verifiable();

            var viewModel = new GenericViewModel();

            var action = new DeleteWorkflow <GenericViewModel>(mockClientServicesProvider.Object)
            {
                OnComplete = model => viewModel = model
            };

            // Act
            var result = action.Invoke(workflowDto);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(GenericViewModel));
            Assert.IsNotNull(result.Notifications);
            Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection));
            Assert.IsTrue(result.Notifications.Count() == 1);
            Assert.IsTrue(result.HasErrors);
            Assert.IsNotNull(result.Success);
            Assert.IsInstanceOfType(result.Success, typeof(bool));
            Assert.IsFalse(result.Success);
        }
Exemplo n.º 3
0
        public static void CanDelete(DeleteWorkflow command, IAppEntity app)
        {
            Guard.NotNull(command, nameof(command));

            var workflows = app.Workflows;

            CheckWorkflowExists(workflows, command.WorkflowId);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> DeleteWorkflow(string app, DomainId id)
        {
            var command = new DeleteWorkflow {
                WorkflowId = id
            };

            var response = await InvokeCommandAsync(command);

            return(Ok(response));
        }
Exemplo n.º 5
0
        public async Task DeleteWorkflow_should_create_events_and_update_state()
        {
            var command = new DeleteWorkflow {
                WorkflowId = workflowId
            };

            await ExecuteCreateAsync();
            await ExecuteAddWorkflowAsync();

            var result = await sut.ExecuteAsync(CreateCommand(command));

            result.ShouldBeEquivalent(sut.Snapshot);

            Assert.Empty(sut.Snapshot.Workflows);

            LastEvents
            .ShouldHaveSameEvents(
                CreateEvent(new AppWorkflowDeleted {
                WorkflowId = workflowId
            })
                );
        }
Exemplo n.º 6
0
 private void DeleteWorkflow(DeleteWorkflow command)
 {
     Raise(command, new AppWorkflowDeleted());
 }
Exemplo n.º 7
0
 public void DeleteWorkflow(DeleteWorkflow command)
 {
     RaiseEvent(SimpleMapper.Map(command, new AppWorkflowDeleted()));
 }
Exemplo n.º 8
0
        public static void CanDelete(Workflows workflows, DeleteWorkflow command)
        {
            Guard.NotNull(command, nameof(command));

            GetWorkflowOrThrow(workflows, command.WorkflowId);
        }
Exemplo n.º 9
0
        public static void CanDelete(Workflows workflows, DeleteWorkflow command)
        {
            Guard.NotNull(command, nameof(command));

            CheckWorkflowExists(workflows, command.WorkflowId);
        }