Example #1
0
        public StateMachine<Status, Operation> StateMachine()
        {
            var machine = new StateMachine<Status, Operation>(() => this.Status, (x) => this.Status = x);

            machine
                .When(Status.UnSaved)
                .Permit(Operation.Save, Status.Saved);
            machine
                .When(Status.Saved)
                .Permit(Operation.Save)
                .Permit(Operation.Submit, Status.Submitted);

            return machine;
        }