public void ItShouldReturnCorrectTotalForItemScannedItem() { var banana = new Banana(); CheckoutCounter.Scan(banana); Assert.That(CheckoutCounter.Total(), Is.EqualTo(banana.GetCost())); }
/// <summary> /// 跳转方式获得数据 /// </summary> /// <param name="info"></param> /// <param name="orderInfo"></param> /// <param name="postUrl"></param> /// <returns></returns> public IDictionary <string, string> PayByCounter(MerchantInfo info, CheckoutCounter orderInfo, out string postUrl) { postUrl = host + "/order/gwayOrderPay"; var dict = new Dictionary <string, string> { { "orderCode", orderInfo.orderCode }, { "totalAmount", orderInfo.totalAmount.ToString().PadLeft(12, '0') }, { "subject", orderInfo.subject }, { "body", orderInfo.body } }; if (string.IsNullOrEmpty(orderInfo.txnTimeOut)) { dict.Add("txnTimeOut", orderInfo.txnTimeOut); } dict.Add("payMode", orderInfo.payMode); if (string.IsNullOrEmpty(orderInfo.payExtra)) { dict.Add("payExtra", orderInfo.payExtra); } dict.Add("clientIp", orderInfo.clientIp); dict.Add("notifyUrl", orderInfo.notifyUrl); dict.Add("frontUrl", orderInfo.frontUrl); if (string.IsNullOrEmpty(orderInfo.storeId)) { dict.Add("storeId", orderInfo.storeId); } if (string.IsNullOrEmpty(orderInfo.terminalId)) { dict.Add("terminalId", orderInfo.terminalId); } if (string.IsNullOrEmpty(orderInfo.operatorId)) { dict.Add("operatorId", orderInfo.operatorId); } dict.Add("clearCycle", Convert.ToInt32(orderInfo.clearCycle).ToString()); if (string.IsNullOrEmpty(orderInfo.riskRateInfo)) { dict.Add("riskRateInfo", orderInfo.riskRateInfo); } if (string.IsNullOrEmpty(orderInfo.bizExtendParams)) { dict.Add("bizExtendParams", orderInfo.bizExtendParams); } if (string.IsNullOrEmpty(orderInfo.merchExtendParams)) { dict.Add("merchExtendParams", orderInfo.merchExtendParams); } if (string.IsNullOrEmpty(orderInfo.extend)) { dict.Add("extend", orderInfo.extend); } return(dict); }
public void ItShouldReturnCorrectTotalForTwentyPercentDiscount() { var banana = BananaTwentyPenceDiscountBuilder.Build.AnInstance(); CheckoutCounter.Scan(banana); Assert.That(CheckoutCounter.Total(), Is.EqualTo(0.5M)); }
public void ItShouldReturnTheCorrectCostOfTwoOranges() { var orange = new Orange(); CheckoutCounter.Scan(orange); CheckoutCounter.Scan(orange); Assert.That(CheckoutCounter.Total(), Is.EqualTo(orange.GetCost() * 2)); }
public void ItShouldReturnTheCorrectTotalForTwoForAPoundDiscount() { var banana = new Banana(); CheckoutCounter.Scan(banana); CheckoutCounter.Scan(banana); Assert.That(CheckoutCounter.Total(), Is.EqualTo(1.0M)); }
public void ItShouldReturnTheCorrectTotalForAppleTwoForOneDiscount() { var apple = new Apple(); CheckoutCounter.Scan(apple); CheckoutCounter.Scan(apple); Assert.That(CheckoutCounter.Total(), Is.EqualTo(apple.GetCost())); }
public void ItShouldReturnCorrectPriceIf2OfTheSameItemIsScanned() { var orange = new Orange(); CheckoutCounter.Scan(orange); CheckoutCounter.Scan(orange); Assert.That(CheckoutCounter.Total(), Is.EqualTo(orange.GetCost() * 2)); }
public void ItShouldReturnCorrectPriceFor2DifferentItemsAreScanned() { var apple = new Apple(); var orange = new Orange(); CheckoutCounter.Scan(apple); CheckoutCounter.Scan(orange); Assert.That(CheckoutCounter.Total(), Is.EqualTo(apple.GetCost() + orange.GetCost())); }
public void ItShouldReturnTheCorrectDiscountOfThreeOrangesForNinetyPence() { var orange = new Orange(); CheckoutCounter.Scan(orange); CheckoutCounter.Scan(orange); CheckoutCounter.Scan(orange); Assert.That(CheckoutCounter.Total(), Is.EqualTo(0.9M)); }
public void ItShouldReturnTheCorrectTotalForBananaTwoForAPoundDiscountWhenInDifferentOrder() { var banana = new Banana(); var orange = new Orange(); var apple = new Apple(); CheckoutCounter.Scan(banana); CheckoutCounter.Scan(orange); CheckoutCounter.Scan(banana); CheckoutCounter.Scan(apple); Assert.That(CheckoutCounter.Total(), Is.EqualTo(1.00M + orange.GetCost() + apple.GetCost())); }
public void ItShouldReturnTheCorrectDiscountOfThreeOrangesForNinetyPenceWhenNotInOrder() { var orange = new Orange(); var apple = new Apple(); CheckoutCounter.Scan(orange); CheckoutCounter.Scan(apple); CheckoutCounter.Scan(orange); CheckoutCounter.Scan(apple); CheckoutCounter.Scan(apple); CheckoutCounter.Scan(orange); Assert.That(CheckoutCounter.Total(), Is.EqualTo(0.9M + apple.GetCost() * 3)); }
public string GetObjectDescription(StoreObject obj) { DisplayShelf possibleDisplayShelf = obj.GetComponent <DisplayShelf>(); if (possibleDisplayShelf != null) { return("Shelf used to hold products"); } BudtenderCounter possibleBudtenderCounter = obj.GetComponent <BudtenderCounter>(); if (possibleBudtenderCounter != null) { return("Opens " + possibleBudtenderCounter.stations.Count + " budtender jobs. Budtenders assist customers and keep your shelves stocked"); } CheckoutCounter possibleCheckoutCounter = obj.GetComponent <CheckoutCounter>(); if (possibleCheckoutCounter != null) { return("Place for customers to check out"); } return("Error: " + obj.ToString()); }
public void ItShouldThrowItemNotFoundExceptionIfScanningEmpty() { Assert.Throws <ItemNotFoundException>(() => CheckoutCounter.Scan(null)); }