Ejemplo n.º 1
0
        public void RemoveItemInFridge()
        {
            var repository = new FakeItemRepository();
            var flourItem  = new Item
            {
                Name     = "Flour",
                Quantity = new Quantity()
                {
                    Unit = "L", Total = 1
                }
            };

            repository.Items.Add(flourItem);
            var eggItem = new Item
            {
                Name     = "Egg",
                Quantity = new Quantity()
                {
                    Unit = "P", Total = 8
                }
            };

            repository.Items.Add(eggItem);

            var worker       = new FridgeService(repository);
            var eggsToRemove = new Item
            {
                Name     = "Egg",
                Quantity = new Quantity()
                {
                    Unit = "P", Total = 3
                }
            };

            var result = worker.RemoveItem(eggsToRemove);

            Assert.AreEqual(result.Total, 5);
        }
Ejemplo n.º 2
0
 public Quantity Remove([FromBody] Item item)
 {
     return(_fridgeService.RemoveItem(item));
 }