Пример #1
0
        public void Quantity_in_Basket_cannot_be_negative()
        {
            var expectedItem = new BasketItem(new CatalogItem("Item 1", "1234item", 10.50), 5);

            var basket = new Basket(new List <BasketItem>());

            basket.AddItem(expectedItem);
            Assert.IsTrue(basket.ReturnItemQuantity(expectedItem.CatalogItem.ItemId) == 5);

            expectedItem.SetQuantity(100);
            basket.RemoveItem(expectedItem);
            Assert.IsTrue(basket.ReturnItemQuantity(expectedItem.CatalogItem.ItemId) == 0);
        }
Пример #2
0
        public void Decrease_quantity_of_existing_item_inBasket()
        {
            var expectedItem = new BasketItem(new CatalogItem("Item 1", "1234item", 10.50), 5);

            var basket = new Basket(new List <BasketItem>());

            basket.AddItem(expectedItem);
            Assert.IsTrue(basket.ReturnItemQuantity(expectedItem.CatalogItem.ItemId) == 5);

            expectedItem.SetQuantity(2);
            basket.RemoveItem(expectedItem);
            Assert.IsTrue(basket.ReturnItemQuantity(expectedItem.CatalogItem.ItemId) == 3);
        }