Example #1
0
        public void TestNoHandler()
        {
            ServiceTicket serviceTicket = new ServiceTicket()
            {
                State = context.AllStates().First(e => e.Code == "Open"),
                Name  = "An example service ticket"
            };

            StateMachine.RequestTransition(serviceTicket, "Transition_Cancel");
            Assert.Fail();
        }
Example #2
0
        public void TestValidTransition()
        {
            ServiceTicket serviceTicket = new ServiceTicket()
            {
                Name = "An example service ticket"
            };

            StateMachine.RequestTransition(serviceTicket, "Transition_New");

            Assert.IsTrue(serviceTicket.State.Code == "New");
        }
Example #3
0
        public void TestReverseTransition()
        {
            ServiceTicket serviceTicket = new ServiceTicket()
            {
                State = context.AllStates().First(e => e.Code == "Closed"),
                Name  = "Closed service ticket"
            };

            StateMachine.RequestTransition(serviceTicket, "Transition_ReOpen");

            Assert.IsTrue(serviceTicket.State.Code == "Open");
        }
Example #4
0
 public override ServiceTicket ValidateTransition(ServiceTicket entity, ServiceTicketState nextState, IDictionary <string, object> argumentsMap = null)
 {
     return(entity);
 }
Example #5
0
 public override ServiceTicket Execute(ServiceTicket entity, ServiceTicketState nextState, IDictionary <string, object> argumentsMap = null)
 {
     entity.State = nextState;
     return(entity);
 }