public void Normal_OverPriceItem() { Product p = new Product() { Name = "蘋果", Price = 5555 }; PaymentGate context = new PaymentGate(p); Assert.AreEqual("交易建立中...", context.RunProcess()); Assert.AreEqual("物件超過300元 交易取消中", context.RunProcess()); Assert.AreEqual("交易取消完成", context.RunProcess()); }
public void Normal_Item() { Product p = new Product() { Name = "蘋果", Price = 30 }; PaymentGate context = new PaymentGate(p); Assert.AreEqual("交易建立中...", context.RunProcess()); Assert.AreEqual("交易中請稍後", context.RunProcess()); Assert.AreEqual("交易完成", context.RunProcess()); }
public void SetProcess_Success_AlterDontResetAgain() { Product p = new Product() { Name = "蘋果", Price = 30 }; PaymentGate context = new PaymentGate(p); Assert.AreEqual("請勿重新建立訂單", context.SetStatus(PayStatus.Init)); Assert.AreEqual("交易建立中...", context.RunProcess()); Assert.AreEqual("請勿重新建立訂單", context.SetStatus(PayStatus.Init)); Assert.AreEqual("交易中請稍後", context.RunProcess()); Assert.AreEqual("交易完成", context.RunProcess()); Assert.AreEqual("訂單成功請勿修改", context.SetStatus(PayStatus.Init)); }
public void SetProcess_Cancel_AlterDontResetAgain() { Product p = new Product() { Name = "蘋果", Price = 3000 }; PaymentGate context = new PaymentGate(p); Assert.AreEqual("請勿重新建立訂單", context.SetStatus(PayStatus.Init)); Assert.AreEqual("交易建立中...", context.RunProcess()); Assert.AreEqual("請勿重新建立訂單", context.SetStatus(PayStatus.Init)); Assert.AreEqual("物件超過300元 交易取消中", context.RunProcess()); Assert.AreEqual("交易取消完成", context.RunProcess()); Assert.AreEqual("訂單取消請勿修改", context.SetStatus(PayStatus.Init)); }
public SuccessStatus(PaymentGate g) { _gate = g; }
public ProcessStatus(PaymentGate g) { _gate = g; }
public CardinityPayment(PaymentGate PaymentGate) { _PaymentGate = PaymentGate; }
public InitStatus(PaymentGate g) { _gate = g; }
public CancelStatus(PaymentGate g) { _gate = g; }