Example #1
0
        public static WebMethodResponse BuilderActions(int requestId, WorkflowAction action)
        {
            //TODO: get actorId from current user
            var accessReq = new AccessRequest(requestId);

            switch (action)
            {
                case WorkflowAction.Cancel:
                    return accessReq.NoAccess(action, "");
                case WorkflowAction.Complete:
                    return accessReq.FinalizeRequest();
                case WorkflowAction.Ticket:
                    return accessReq.CreateServiceDeskTicket();

                default:
                    return new WebMethodResponse(false, "BuilderActions", "Unknown action");
            }
        }
Example #2
0
        public void ShouldNotEnterToDifferentStateWhenNotReady()
        {
            using (var db = new SNAPDatabaseDataContext())
            {
                var req = db.SNAP_Requests.Single(x => x.submittedBy == "UnitTester");

                var accessReq = new AccessRequest(req.pkId);
                Assert.IsFalse(accessReq.CreateServiceDeskTicket().Success);
                Assert.IsFalse(accessReq.CreateWorkflow(new List<int>() { 1, 2, 3 }).Success);
                Assert.IsFalse(accessReq.FinalizeRequest().Success);
                Assert.IsFalse(accessReq.RequestChanged().Success);
                accessReq.Ack();
                Assert.IsFalse(accessReq.CreateServiceDeskTicket().Success);
                Assert.IsFalse(accessReq.Ack().Success);
                Assert.IsFalse(accessReq.FinalizeRequest().Success);
                Assert.IsFalse(accessReq.RequestChanged().Success);
            }
        }