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 AdjustTeaspoonsMeasurementToTablespoons() { var adjust = new ConvertCandtToTablespoons(); var actual = adjust.ConvertTeaspoonsToTablespoons("5 teaspoons of something else"); var expected = "1.67 tablespoons"; Assert.AreEqual(expected, actual); }
public void AdjustCupMeasurementToTablespoons() { var adjust = new ConvertCandtToTablespoons(); var actual = adjust.ConvertCupsToTablespoons("4.5 cups flour"); var expected = "72.00 tablespoons"; Assert.AreEqual(expected, actual); }
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); }
public void ConvertFromtToT3() { var c2t = new ConvertCandtToTablespoons(); var line = ".5 teaspoons salt"; var actual = c2t.ConvertTeaspoonsToTablespoons(line); var expected = ".17 tablespoons"; Assert.AreEqual(expected, actual); }
public void convertfromtToT2() { var c2t = new ConvertCandtToTablespoons(); var line = "2 teapsoons baking soda"; var actual = c2t.ConvertTeaspoonsToTablespoons(line); var expected = ".67 tablespoons"; Assert.AreEqual(expected, actual); }
public void ConvertFromttoT() { var CtT = new ConvertCandtToTablespoons(); var line = "3 teaspoons baking powder"; var actual = CtT.ConvertTeaspoonsToTablespoons(line); var expected = "1.00 tablespoon"; Assert.AreEqual(expected, actual); }
public void ConvertFromCupsToTablespoonsTestDecimalPlaces3() { var CtT = new ConvertCandtToTablespoons(); var line = ".125 cups baking cocoa"; var actual = CtT.ConvertCupsToTablespoons(line); var expected = "2.00 tablespoons"; Assert.AreEqual(expected, actual); }
public void ConvertFromCupsToTablespoonsTest() { var CtT = new ConvertCandtToTablespoons(); var line = "1 cup sugar"; var actual = CtT.ConvertCupsToTablespoons(line); var expected = "16.00 tablespoons"; Assert.AreEqual(expected, actual); }
public void ConvertFromCupsToTablespoonsTestDecimalPlaces() { var CtT = new ConvertCandtToTablespoons(); var line = ".5 cups baking cocoa"; var actual = CtT.ConvertCupsToTablespoons(line); var expected = "8.00 tablespoons"; Assert.AreEqual(expected, actual); //something is incorrect with my decimal places, hence the 2 extra chars }