public void AddFoodOfDifferentKinds() { database.FoodCount.ForEach(x => x.Amount = 0); caretakingLogic.AddFood(Enums.Foodtype.Dogfood, 4); caretakingLogic.AddFood(Enums.Foodtype.Catfood, 6); Assert.IsTrue(database.FoodCount.Where(x => x.foodtype == Enums.Foodtype.Dogfood).Select(x => x.Amount).First() == 4 && database.FoodCount.Where(x => x.foodtype == Enums.Foodtype.Catfood).Select(x => x.Amount).First() == 6); }
/// <summary> /// Button event that when clicked adds the inserted amount of foodportions to the total amount of food portions. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnAddFood_Click(object sender, EventArgs e) { if (NudDogFood.Value > 0) { caretakingLogic.AddFood(Enums.Foodtype.Dogfood, (int)NudDogFood.Value); TxtDogFood.Text = caretakingLogic.GetFood(Enums.Foodtype.Dogfood).ToString(); } if (NudCatfood.Value > 0) { caretakingLogic.AddFood(Enums.Foodtype.Catfood, (int)NudCatfood.Value); TxtCatFood.Text = caretakingLogic.GetFood(Enums.Foodtype.Catfood).ToString(); } DtpEmptySupplies.Value = caretakingLogic.CalcDateWhenNoFoodLeft(); ShowFood(); TodoToday(); }