enum class Item { carrot, milk }
interface CashierActions : DdtActions<DdtProtocol> {
fun setupPrices(prices: Map<String, Double>)
fun totalFor(actorName: String): Double
fun addItem(actorName: String, qty: Int, item: Item)
}
class CashierDDT : DomainDrivenTest<CashierActions>(allActions) {
val alice by NamedActor(::Customer)
@DDT
fun `customer can buy an item`() = ddtScenario {
val prices = mapOf(carrot to 2.0, milk to 5.0)
setUp {
setupPrices(prices)
}.thenPlay(
alice.`can add #qty #item`(3, carrot),
alice.`can add #qty #item`(1, milk),
alice.`check total is #total`(11.0)
)
}