コード例 #1
0
        protected override async Task DeleteData(Product entity)
        {
            if (await ProductExistInDiet(entity, diet))
            {
                NutrientsManagement.SubtractNutrients(entity, diet);
            }

            await base.DeleteData(entity);
        }
コード例 #2
0
        public void SubtractNutrients_Success()
        {
            //Act
            NutrientsManagement.SubtractNutrients(product, diet);

            //Arrange
            Assert.Equal(0, diet.TotalCalories);
            Assert.Equal(0, diet.TotalCarbohydrates);
            Assert.Equal(0, diet.TotalFats);
            Assert.Equal(0, diet.TotalProteins);
        }