14. Returns are written as features
Checkout and the parcel are classes: their states, events, guards and rules are C# in the library. Returns are written another way. A customer sends an order back and says why, and the shop checks the order is theirs before it takes the return. That is written as a Gherkin feature, in plain words, with a lexicon that says what the words mean. Trax derives the machine from the two: its states and moves, the guard and its message, who may do what, the train it runs and a view of a customer's returns. The same feature then runs as the machine's tests.
The one piece of C# behind returns is the train that checks the order. The hub serves the derived machine beside checkout, and nothing about it is written by hand.
This chapter starts from the end of chapter 13.
In this chapter
- The flow
- The lexicon
- The features
- Derive the machine
- The check
- Serve it
- Return an order
- The board
- Test it
SDK Reference
Write machines as features | Feature files | Feature machines | Feature bindings | AddStateMachines | Views root | trax CLI
Next: 14.1 The flow