Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public void GivenIHaveCancelledTheOrder()
 {
     var orderId = EventSourceHelper.GetId<Order>();
     var e = new OrderCancelled(orderId);
     GivenHelper.Given(orderId, e);
 }
Esempio n. 3
0
 private void Apply(OrderCancelled e)
 {
     _state = OrderState.Cancelled;
 }