public void Cancel() { switch (_state) { case OrderState.Cancelled: return; case OrderState.Paid: throw new InvalidStateException("You can't cancel this order. It has already been paid."); } var e = new OrderCancelled(Id); ApplyChange(e); }
public void GivenIHaveCancelledTheOrder() { var orderId = EventSourceHelper.GetId<Order>(); var e = new OrderCancelled(orderId); GivenHelper.Given(orderId, e); }
private void Apply(OrderCancelled e) { _state = OrderState.Cancelled; }