コード例 #1
0
        public void RemoveItemTestAddUnSuccesfull()
        {
            // adds successfully
            InventoryItem item = new InventoryItem(new Product("Pepsi", 1.50m), 0);
            var           numberBeforeRemovingItem = InventoryList.First(c => c.Product.Name == "Pepsi").ProductCount;

            removeItem(item);

            Assert.AreEqual((numberBeforeRemovingItem), InventoryList.First(c => c.Product.Name == "Pepsi").ProductCount);
        }
コード例 #2
0
        public void AddItemTestAddSuccesfully()
        {
            // adds successfully
            InventoryItem item = new InventoryItem(new Product("Pepsi", 1.50m), 2);
            var           numberBeforeAddingItem = InventoryList.First(c => c.Product.Name == "Pepsi").ProductCount;

            addItem(item);

            Assert.AreEqual((numberBeforeAddingItem + 2), InventoryList.First(c => c.Product.Name == "Pepsi").ProductCount);
        }