Exemplo n.º 1
0
        private void SetTestData()
        {
            shoppingList = new List <ShoppedItem>();
            ShoppedItem test1 = new ShoppedItem("몬스터X 라지 세트", 26, 1);
            ShoppedItem test2 = new ShoppedItem("몬스터X 라지 세트", 20, 1);
            ShoppedItem test3 = new ShoppedItem("몬스터X 라지 세트", 21, 1);
            ShoppedItem test4 = new ShoppedItem("닭갈비버거", 27, 1);

            shoppingList.Add(test1);
            shoppingList.Add(test2);
            shoppingList.Add(test3);
            shoppingList.Add(test4);
        }
Exemplo n.º 2
0
        private void AddtoCart()
        {
            Product     product     = DataRepository.Product.GetByName(productName);
            ShoppedItem shoppedItem = new ShoppedItem(productName + package, product.ProductId, 1);

            OrderInfo.Instance.shoppedItemList.Add(shoppedItem);

            if (package.Equals("") != true)
            {
                ShoppedItem beverage = new ShoppedItem(productName + package, OrderInfo.Instance.selectedBeverage, 1);
                ShoppedItem side     = new ShoppedItem(productName + package, OrderInfo.Instance.selectedSide, 1);
                OrderInfo.Instance.shoppedItemList.Add(beverage);
                OrderInfo.Instance.shoppedItemList.Add(side);
            }
        }
Exemplo n.º 3
0
        public void TestCheckoutKataWhenHaveNormalPriceAndOffer()
        {
            item = new Item()
            {
                Name = "B", Price = 30
            };
            checkoutKata.AddItems(item);

            shoppedItem = new ShoppedItem()
            {
                Name = "B", Count = 3
            };
            checkoutKata.AddShoppedItem(shoppedItem);

            var result = checkoutKata.CalculateTotalPrice();

            Assert.AreEqual(75, result);
        }
Exemplo n.º 4
0
        public void TestCheckoutKataWhenMatchNoOffer()
        {
            item = new Item()
            {
                Name = "A", Price = 50
            };
            checkoutKata.AddItems(item);

            shoppedItem = new ShoppedItem()
            {
                Name = "A", Count = 2
            };
            checkoutKata.AddShoppedItem(shoppedItem);

            var result = checkoutKata.CalculateTotalPrice();

            Assert.AreEqual(100, result);
        }
Exemplo n.º 5
0
        public void TestCheckoutKataWhenAddNewItemWithoutOffer()
        {
            item = new Item()
            {
                Name = "E", Price = 45
            };
            checkoutKata.AddItems(item);

            shoppedItem = new ShoppedItem()
            {
                Name = "E", Count = 1
            };
            checkoutKata.AddShoppedItem(shoppedItem);

            var result = checkoutKata.CalculateTotalPrice();

            Assert.AreEqual(45, result);
        }