예제 #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);
 }