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());
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        public void AdjustCupMeasurementToTablespoons()
        {
            var adjust   = new ConvertCandtToTablespoons();
            var actual   = adjust.ConvertCupsToTablespoons("4.5 cups flour");
            var expected = "72.00 tablespoons";

            Assert.AreEqual(expected, actual);
        }
Exemple #4
0
        public void RoundingTablespoonsTest2()
        {
            var adjust   = new ConvertCandtToTablespoons();
            var actual   = adjust.RoundTablespoonMeasurement("12 tablespoons");
            var expected = "12 tablespoons";

            Assert.AreEqual(expected, actual);
        }
Exemple #5
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);
        }
Exemple #6
0
        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);
        }
Exemple #7
0
        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);
        }
Exemple #8
0
        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);
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        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);
        }
Exemple #11
0
        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
        }