예제 #1
0
        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());
        }
예제 #2
0
        public void RoundingTablespoonsTest2()
        {
            var adjust   = new ConvertCandtToTablespoons();
            var actual   = adjust.RoundTablespoonMeasurement("12 tablespoons");
            var expected = "12 tablespoons";

            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        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);
        }