コード例 #1
0
ファイル: Application.cs プロジェクト: BojanStankovic/WebShop
        public void Run()
        {
            // Simulate adding valid discounts and products to the shopping basket
            // for given scenarios
            _shoppingBasket.AddDiscount(_dataUtilities.GetDiscount("0"));
            _shoppingBasket.AddDiscount(_dataUtilities.GetDiscount("1"));

            _shoppingBasket.AddItem(_dataUtilities.GetItem("1"), 1); // Milk
            _shoppingBasket.AddItem(_dataUtilities.GetItem("0"), 1); // Butter
            _shoppingBasket.AddItem(_dataUtilities.GetItem("2"), 1); // Bread
            _shoppingBasket.GetTotalSum();
            _shoppingBasket.EmptyBasket();

            _shoppingBasket.AddItem(_dataUtilities.GetItem("0"), 2); // Butter
            _shoppingBasket.AddItem(_dataUtilities.GetItem("2"), 2); // Bread
            _shoppingBasket.GetTotalSum();
            _shoppingBasket.EmptyBasket();

            _shoppingBasket.AddItem(_dataUtilities.GetItem("1"), 4); // Milk
            _shoppingBasket.GetTotalSum();
            _shoppingBasket.EmptyBasket();

            _shoppingBasket.AddItem(_dataUtilities.GetItem("1"), 8); // Milk
            _shoppingBasket.AddItem(_dataUtilities.GetItem("0"), 2); // Butter
            _shoppingBasket.AddItem(_dataUtilities.GetItem("2"), 1); // Bread
            _shoppingBasket.GetTotalSum();
            _shoppingBasket.EmptyBasket();
        }