Beispiel #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);
 }
 public abstract void Reject(ref OrderState state);
 public abstract void Complete(ref OrderState state);
 public abstract void Submit(ref OrderState state);
Beispiel #5
0
 public override void Submit(ref OrderState state)
 {
     throw new InvalidOperationException("A rejected can't be submitted");
 }
Beispiel #6
0
 public override void Reject(ref OrderState state)
 {
     throw new InvalidOperationException("This order is already rejected");
 }
Beispiel #7
0
 public override void Complete(ref OrderState state)
 {
     throw new InvalidOperationException("A reject order can't be completed");
 }
Beispiel #8
0
 public override void Reject(ref OrderState state)
 {
     throw new InvalidOperationException("A completed can't be rejected");
 }
Beispiel #9
0
 public override void Complete(ref OrderState state)
 {
     throw new InvalidOperationException("This order is already completed");
 }
Beispiel #10
0
 public override void Reject(ref OrderState state)
 {
     throw new InvalidOperationException("Order must be submitted (pending) before it can be rejected");
 }
Beispiel #11
0
 public override void Submit(ref OrderState state)
 {
     //NO-OP
 }
Beispiel #12
0
 public override void Reject(ref OrderState state)
 {
     state = new OrderRejected(_orderHeader);
 }
Beispiel #13
0
 public override void Complete(ref OrderState state)
 {
     state = new OrderComplete(_orderHeader);
 }