コード例 #1
0
ファイル: AccessRequest_Test.cs プロジェクト: apxlee/SAP
        public void ShouldCreateWorkflowByAccessTeamAndThenMakeModification()
        {
            using (var db = new SNAPDatabaseDataContext())
            {
                var accessReq = createTestWorkflow(db, new List<int>() { managerActorId, teamApprovalActorId, windowsServerActorId });
            }

            using (var db = new SNAPDatabaseDataContext())
            {
                var req = db.SNAP_Requests.Single(x => x.submittedBy == "UnitTester");

                var accessReq = new AccessRequest(req.pkId);

                accessReq.EditWorkflow(managerUserId, new List<int>() { windowsServerActorId, databaseActorId, networkShareActorId });
                //accessReq.CreateWorkflow(new List<int>() { managerActorId });

                var accessTeamWF = db.SNAP_Workflows.Single(x => x.requestId == req.pkId && x.actorId == accessTeamActorId);
                var accessTeamWFStates = db.SNAP_Workflow_States.Where(x => x.workflowId == accessTeamWF.pkId);
                foreach (var s in accessTeamWFStates)
                {
                    Console.WriteLine(s.workflowId + "," + s.workflowStatusEnum + "," + ((s.completedDate != null) ? s.completedDate.ToString() : "TBD"));
                }

                verifyWorkflowState(accessTeamWF, WorkflowState.Workflow_Created);
                var managerWF = db.SNAP_Workflows.Single(x => x.requestId == req.pkId && x.actorId == managerActorId);
                var managerWFStates = db.SNAP_Workflow_States.Where(x => x.workflowId == managerWF.pkId);
                foreach (var s in managerWFStates)
                {
                    Console.WriteLine(s.workflowId + "," + s.workflowStatusEnum + "," + ((s.completedDate != null) ? s.completedDate.ToString() : "TBD"));
                }
                verifyWorkflowStateComplete(managerWF, WorkflowState.Not_Active);
                verifyWorkflowState(managerWF, WorkflowState.Pending_Approval);

                var wfs = accessReq.FindApprovalTypeWF(db, (byte)ActorApprovalType.Team_Approver);
                Assert.IsTrue(wfs.Count == 0);

                wfs = accessReq.FindApprovalTypeWF(db, (byte)ActorApprovalType.Technical_Approver);
                Assert.IsTrue(wfs.Count == 3);

                foreach(var wf in wfs)
                {
                    verifyWorkflowState(wf, WorkflowState.Not_Active);
                }
            }
        }
コード例 #2
0
ファイル: AjaxActions.aspx.cs プロジェクト: apxlee/SAP
 public static WebMethodResponse EditWorkflow(int requestId, string managerUserId, string actorIds)
 {
     var accessReq = new AccessRequest(requestId);
     List<int> actorsList = GetActorsList(actorIds);
     return accessReq.EditWorkflow(managerUserId, actorsList);
 }
コード例 #3
0
ファイル: AccessRequest_Test.cs プロジェクト: apxlee/SAP
        public void ShouldHandleRemoveInactiveApprovers()
        {
            using (var db = new SNAPDatabaseDataContext())
            {
                var accessReq = createTestWorkflow(db, new List<int>()
                                                           {
                                                               managerActorId,
                                                               windowsServerActorId,
                                                               databaseActorId,
                                                           });
            }

            using (var db = new SNAPDatabaseDataContext())
            {
                var req = db.SNAP_Requests.Single(x => x.submittedBy == "UnitTester");
                var accessReq = new AccessRequest(req.pkId);

                accessReq.EditWorkflow(managerUserId, new List<int>() { managerActorId });

                Assert.IsTrue(req.statusEnum == (byte) RequestState.Pending);
                var wfs = accessReq.FindApprovalTypeWF(db, (byte)ActorApprovalType.Workflow_Admin);
                Assert.IsTrue(wfs[0].SNAP_Workflow_States.OrderByDescending(s=>s.pkId).
                    First().workflowStatusEnum == (byte)WorkflowState.Workflow_Created);
            }
        }