예제 #1
0
        public void FridgeItem_ConsumeConsumed_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.ConsumeFridgeItem(amountValToConsume));
        }
예제 #2
0
        public void FridgeItem_ConsumeWithSameAmountValue_ShouldSetIsConsumed()
        {
            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);

            Assert.AreEqual(true, fridgeItem.IsConsumed);
        }