public string[] AdjustRecipeTablespoonMeasurements(string filename, decimal multiplier) { var ConvertMeasurements = new ConvertCandtToTablespoons(); var ReadMyFile = new Reader(); var MyFile = ReadMyFile.ReadRecipe(filename); var MyRecipe = new List <string>(); var IngredientMeasurement = ""; foreach (var ingredient in MyFile) { if (ingredient.Contains("cup")) { IngredientMeasurement = ConvertMeasurements.ConvertCupsToTablespoons(ingredient); } if (ingredient.Contains("tablespoon")) { IngredientMeasurement = ConvertMeasurements.RoundTablespoonMeasurement(ingredient); } if (ingredient.Contains("teaspoon")) { IngredientMeasurement = ConvertMeasurements.ConvertTeaspoonsToTablespoons(ingredient); } MyRecipe.Add(IngredientMeasurement); } return(MyRecipe.ToArray()); }
public void RoundingTablespoonsTest2() { var adjust = new ConvertCandtToTablespoons(); var actual = adjust.RoundTablespoonMeasurement("12 tablespoons"); var expected = "12 tablespoons"; Assert.AreEqual(expected, actual); }
public void Tablespoons() { var c2t = new ConvertCandtToTablespoons(); var line = "4.333 tablespoons"; var actual = c2t.RoundTablespoonMeasurement(line); var expected = "4.33 tablespoons"; Assert.AreEqual(expected, actual); }