public void TestIgnoreUnknownBasketItems() { string[] stringBasket = { "apple", "orange", "banana", "motorcycle" }; BasketModel basket = GroceryKioskHelper.GetItemAndAddOrUpdateBasket(stringBasket, _itemList); Assert.AreEqual(3, basket.Basket.Count); Assert.AreEqual(4.5M, basket.Total); }
public void TestAddingOneItemToBasket() { string[] stringBasket = { "Apple" }; BasketModel basket = GroceryKioskHelper.GetItemAndAddOrUpdateBasket(stringBasket, _itemList); Assert.AreEqual(1, basket.Basket.Count); Assert.AreEqual(1.5M, basket.Total); }
public void TestAddingMultipleItemsToBasketIgnoreCase() { string[] stringBasket = { "apple", "orange", "banana" }; BasketModel basket = GroceryKioskHelper.GetItemAndAddOrUpdateBasket(stringBasket, _itemList); Assert.AreEqual(3, basket.Basket.Count); Assert.AreEqual(4.5M, basket.Total); }
/// <summary> /// Begins the User Transaction for checking out goods at the grocery kiosk. /// </summary> /// <param name="userBasket"> Takes a list of items the user would like to purchase</param> /// <returns>A user basket with total price and discounts applied.</returns> public BasketModel BeginTransaction(string[] userBasket) { List <ItemModel> kioskItems = _dataStore.GetKioskItems(); List <PromotionModel> kisokPromotions = _dataStore.GetKioskPromotions(); var basket = GroceryKioskHelper.GetItemAndAddOrUpdateBasket(userBasket, kioskItems); _promotionService.ApplyPromotionsToBasket(basket, kisokPromotions); return(basket); }