示例#1
0
        public void Custom_workflow_types_are_retrieved_correctly()
        {
            // Arrange
            TerminationWorkflow workflow = new TerminationWorkflow
            {
                Employee          = "Burt Reynolds",
                TerminationReason = "Too much mustache"
            };

            WorkflowStep step2 = new WorkflowStep {
                Title = "Termination: " + workflow.Employee, AssignedTo = AssignToUser
            };

            workflow.AddStep(step2);

            // Act

            // Adding a workflow saves it to the database.
            _workflowService.AddWorkflow(workflow);

            var id = workflow.Id;

            _workflowService.LoadWorkflows();

            var retrievedWorkflow = _workflowService.Workflows.Where(w => w.Key == id).Select(w => w.Value).FirstOrDefault();

            // Assert
            Assert.AreEqual(typeof(TerminationWorkflow).ToString(), retrievedWorkflow.GetType().ToString());
            Assert.AreEqual("Too much mustache", ((TerminationWorkflow)retrievedWorkflow).TerminationReason);
        }
示例#2
0
        public void Can_save_and_reload_multiple_workflows()
        {
            // Arrange
            PayraiseWorkflow workflow1 = new PayraiseWorkflow
            {
                Employee = "Bob Dole",
                RequestedSalaryAmount = 30000
            };

            WorkflowStep step1 = new WorkflowStep {
                Title = "Request for payraise: " + workflow1.Employee, AssignedTo = AssignToUser
            };

            workflow1.AddStep(step1);

            TerminationWorkflow workflow2 = new TerminationWorkflow
            {
                Employee          = "Burt Reynolds",
                TerminationReason = "Too much mustache"
            };

            WorkflowStep step2 = new WorkflowStep {
                Title = "Termination: " + workflow2.Employee, AssignedTo = AssignToUser
            };

            workflow2.AddStep(step2);

            // Act

            // Adding a workflow saves it to the database.
            _workflowService.AddWorkflow(workflow1);
            _workflowService.AddWorkflow(workflow2);

            _workflowService.LoadWorkflows();
        }
示例#3
0
        public void Can_retrieve_specific_workflow()
        {
            // Arrange
            PayraiseWorkflow workflow1 = new PayraiseWorkflow
            {
                Employee = "Bob Dole",
                RequestedSalaryAmount = 30000
            };

            WorkflowStep step1 = new WorkflowStep {
                Title = "Request for payraise: " + workflow1.Employee, AssignedTo = AssignToUser
            };

            workflow1.AddStep(step1);

            TerminationWorkflow workflow2 = new TerminationWorkflow
            {
                Employee          = "Burt Reynolds",
                TerminationReason = "Too much mustache"
            };

            WorkflowStep step2 = new WorkflowStep {
                Title = "Termination: " + workflow2.Employee, AssignedTo = AssignToUser
            };

            workflow2.AddStep(step2);

            // Act

            // Adding a workflow saves it to the database.
            _workflowService.AddWorkflow(workflow1);
            _workflowService.AddWorkflow(workflow2);

            var id = workflow2.Id;

            _workflowService.LoadWorkflows();

            var retrievedWorkflow = _workflowService.Workflows.Where(w => w.Key == id).Select(w => w.Value).FirstOrDefault();

            // Assert
            Assert.IsNotNull(retrievedWorkflow);
        }