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