Пример #1
0
        public void GetCartTotalTest()
        {
            Dictionary <Item, int> cart = new Dictionary <Item, int>();

            Item item1 = new Item
            {
                sellingPrice = 50
            };

            cart.Add(item1, 5); // 5 * 50 = 250

            Item item2 = new Item
            {
                sellingPrice = 20
            };

            cart.Add(item2, 2); // 20 * 2 = 40

            // cart total should be 290.

            var total = CheckoutFacilitator.GetCartTotal(cart);

            if (total != 290)
            {
                Assert.Fail(); // if total not 290, fail test.
            }
        }