public void CalculateCalsAndJouleForMultiple() { var ingredient = new Ingredient { Carbohydrates = 5, Fat = 10, Portion = 50, Protein = 20 }; var ingredient2 = new Ingredient { Carbohydrates = 3, Fat = 2, Portion = 100, Protein = 3 }; var ingredients = new ObservableCollection <IngredientViewModel> { new IngredientViewModel(ingredient), new IngredientViewModel(ingredient2) }; Assert.AreEqual(CerealContentCalculator.CalculateCalsAndJouleForMultiple(ingredients), "140.95 Kcal / 589.7348 KJ"); }
public CerealViewModel(ObservableCollection <IngredientViewModel> selectedIngredientList) { _selectedIngredientList = selectedIngredientList; Protein = CalculateProtein(); Carbohydrates = CalculateCarbohydrates(); Fat = CalculateFat(); EnergyContent = CerealContentCalculator.CalculateCalsAndJouleForMultiple(selectedIngredientList); IncreaseCommand = new RelayCommand(() => Quantity++); DecreaseCommand = new RelayCommand(() => Quantity--); }