public static void ImportFoods() { var json = File.ReadAllText("../../../datasets/foods.json"); var foods = JsonConvert.DeserializeObject <IEnumerable <FoodDto> >(json); FoodStore.AddFoods(foods); }
/// <summary> /// Return the total of the specified metric in the diet /// </summary> /// <param name="metric"></param> /// <returns></returns> public double GetTotal(string metric) { double result = 0; if (FoodStore is null) { // check if initial value provided otherMetricAmounts.TryGetValue(metric, out result); } else { // convert to metric if possible var amount = FoodStore.ConvertTo(metric, AmountConsumed); if (amount != null) { Double.TryParse(result.ToString(), out result); } } return(result); }
public void Dispose() { cs = null; fd = null; }
public void Init() { cs = new VendingMachine(10, 3, 2, 3, 2, 2); fd = new FoodStore(); }