// получение полной информации за конкретный день - список блюд, возможность добавления новых блюд и статистику public void GetDailyInfo(DateTime date) { DailyHistory = new ObservableCollection <EatingHistoryItem>(_repo.GetDailyHistoryData(date)); if (date.Date == DateTime.Now.Date) { IsCurrentDate = true; } else { IsCurrentDate = false; } DailyFoodStatistics = _counter.CountFoodStatistics(DailyHistory.ToList()); }
public void TestMethod1() { List <EatingHistoryItem> items = new List <EatingHistoryItem>(); EatingHistoryItem item1 = new EatingHistoryItem() { Calories = 100, Carbohydrates = 100, Fats = 100, Proteins = 100 }; EatingHistoryItem item2 = new EatingHistoryItem() { Calories = 20, Carbohydrates = 10, Fats = 0, Proteins = 30 }; items.Add(item1); items.Add(item2); FoodStatisticsCounter counter = new FoodStatisticsCounter(); FoodStats stats = counter.CountFoodStatistics(items); Assert.AreEqual(120, stats.Calories); Assert.AreEqual(110, stats.Carbohydrates); Assert.AreEqual(100, stats.Fats); Assert.AreEqual(130, stats.Proteins); }
public void TestMethod1() { List<EatingHistoryItem> items = new List<EatingHistoryItem>(); EatingHistoryItem item1 = new EatingHistoryItem() { Calories = 100, Carbohydrates = 100, Fats = 100, Proteins = 100 }; EatingHistoryItem item2 = new EatingHistoryItem() { Calories = 20, Carbohydrates = 10, Fats = 0, Proteins = 30 }; items.Add(item1); items.Add(item2); FoodStatisticsCounter counter = new FoodStatisticsCounter(); FoodStats stats = counter.CountFoodStatistics(items); Assert.AreEqual(120, stats.Calories); Assert.AreEqual(110, stats.Carbohydrates); Assert.AreEqual(100, stats.Fats); Assert.AreEqual(130, stats.Proteins); }