Пример #1
0
 public override void Submit(ref OrderState state)
 {
     //business rule: an order must has at least one order item
     if (!_orderHeader.OrderItems.Any())
     {
         throw new InvalidOperationException("A new order must have at least one item before it can be submitted");
     }
     state = new OrderPending(_orderHeader);
 }
Пример #2
0
 public abstract void Reject(ref OrderState state);
Пример #3
0
 public abstract void Complete(ref OrderState state);
Пример #4
0
 public abstract void Submit(ref OrderState state);
Пример #5
0
 public override void Submit(ref OrderState state)
 {
     throw new InvalidOperationException("A rejected can't be submitted");
 }
Пример #6
0
 public override void Reject(ref OrderState state)
 {
     throw new InvalidOperationException("This order is already rejected");
 }
Пример #7
0
 public override void Complete(ref OrderState state)
 {
     throw new InvalidOperationException("A reject order can't be completed");
 }
Пример #8
0
 public override void Reject(ref OrderState state)
 {
     throw new InvalidOperationException("A completed can't be rejected");
 }
Пример #9
0
 public override void Complete(ref OrderState state)
 {
     throw new InvalidOperationException("This order is already completed");
 }
Пример #10
0
 public override void Reject(ref OrderState state)
 {
     throw new InvalidOperationException("Order must be submitted (pending) before it can be rejected");
 }
Пример #11
0
 public override void Submit(ref OrderState state)
 {
     //NO-OP
 }
Пример #12
0
 public override void Reject(ref OrderState state)
 {
     state = new OrderRejected(_orderHeader);
 }
Пример #13
0
 public override void Complete(ref OrderState state)
 {
     state = new OrderComplete(_orderHeader);
 }