Пример #1
0
        public void FridgeItem_UpdateItemNote_ShouldHaveNewValue()
        {
            FoodProduct foodProduct = new FoodProduct("Mleko", _category);
            AmountValue amountValue = new AmountValue(15.3f, Unit.Grams);

            var    fridgeItem  = new FridgeItem(foodProduct.FoodProductId, "desc", amountValue);
            string noteUpdated = "updatedDesc";

            fridgeItem.UpdateFridgeItemNote(noteUpdated);
            Assert.AreEqual(fridgeItem.Note, noteUpdated);
        }
Пример #2
0
        public void FridgeItem_UpdateConsumed_ShouldThrowException()
        {
            FoodProduct foodProduct = new FoodProduct("Mleko", _category);
            AmountValue amountValue = new AmountValue(100.0f, Unit.Mililiter);
            FridgeItem  fridgeItem  = new FridgeItem(foodProduct.FoodProductId, "desc", amountValue);

            AmountValue amountValToConsume = new AmountValue(100.0f, Unit.Mililiter);

            fridgeItem.ConsumeFridgeItem(amountValToConsume); // first consume

            Assert.AreEqual(true, fridgeItem.IsConsumed);
            Assert.Throws(typeof(DomainException), () => fridgeItem.UpdateFridgeItemNote("updated"));
        }