예제 #1
0
        public void UpdateItemInFridge()
        {
            var repository = new FakeItemRepository();
            var flourItem  = new Item
            {
                Name     = "Egg",
                Quantity = new Quantity()
                {
                    Unit = "P", Total = 8
                }
            };

            repository.Items.Add(flourItem);

            var worker = new FridgeService(repository);

            var eggItem = new Item
            {
                Name     = "Egg",
                Quantity = new Quantity()
                {
                    Unit = "P", Total = 8
                }
            };

            var result = worker.AddItem(eggItem);

            Assert.AreEqual(result.Unit, "P");
            Assert.AreEqual(result.Total, 16);
        }
예제 #2
0
 public Quantity Create([FromBody] Item item)
 {
     return(_fridgeService.AddItem(item));
 }