public void Restore_quantity_of_milk_after_applying_discount() { var item = new BasketItem(ProductData.Milk, 8); var basketRepository = new BasketRepository(); basketRepository.AddItem(item); var items = basketRepository.GetBasketItems(); var milkItem = items.FirstOrDefault(x => x.Product.Name.Equals("Milk")); Assert.Equal(8, milkItem.Quantity); }
public void Add_one_item_to_basket() { var p1 = new Product("Milk", 2.50); var item = new BasketItem(p1, 3); var basketRepository = new BasketRepository(); basketRepository.AddItem(item); List <BasketItem> actual = basketRepository.GetBasketItems(); Assert.Single(actual); }
public void Update_quantity_when_the_same_item_is_added_twice_to_basket() { var p1 = new Product("Milk", 2.50); var p2 = new Product("Milk", 2.50); var item = new BasketItem(p1, 3); var item2 = new BasketItem(p2, 3); var basketRepository = new BasketRepository(); basketRepository.AddItem(item); basketRepository.AddItem(item2); var actual = basketRepository.GetBasketItems(); Assert.Single(actual); }
public void Add_two_items_to_basket() { var p1 = new Product("Milk", 2.50); var p2 = new Product("Bread", 2.50); var item = new BasketItem(p1, 3); var item2 = new BasketItem(p2, 3); var basketRepository = new BasketRepository(); basketRepository.AddItem(item); basketRepository.AddItem(item2); var actual = basketRepository.GetBasketItems(); Assert.Equal(2, actual.Count); }