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(); }
public void TestValidTransition() { ServiceTicket serviceTicket = new ServiceTicket() { Name = "An example service ticket" }; StateMachine.RequestTransition(serviceTicket, "Transition_New"); Assert.IsTrue(serviceTicket.State.Code == "New"); }
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"); }
public override ServiceTicket ValidateTransition(ServiceTicket entity, ServiceTicketState nextState, IDictionary <string, object> argumentsMap = null) { return(entity); }
public override ServiceTicket Execute(ServiceTicket entity, ServiceTicketState nextState, IDictionary <string, object> argumentsMap = null) { entity.State = nextState; return(entity); }