Esempio n. 1
0
        //i need to rewrite the query to call a different () to get all the information for all the ingredients... i'm not getting an ing.id, densities...
        //only the name and the measurement

        public void UpdateRecipeYield(Recipe r)
        {
            var db          = new DatabaseAccess();
            var dbDensities = new DatabaseAccessDensityInformation();
            var convert     = new ConvertMeasurement();
            var myRecipeBox = MyRecipeBox();

            foreach (var recipe in myRecipeBox)
            {
                var myIngredients  = db.queryAllTablesForAllIngredients(recipe.ingredients);
                var tempIngredient = new Ingredient();
                if (recipe.id == r.id)
                {
                    foreach (var ingredient in recipe.ingredients)
                    {
                        tempIngredient = ingredient;
                        if (tempIngredient.density == 0)
                        {
                            tempIngredient.density = dbDensities.queryDensityTableRowDensityValueByName(ingredient);
                        }
                        tempIngredient.measurement    = convert.AdjustIngredientMeasurement(ingredient.measurement, recipe.yield, r.yield);
                        tempIngredient.ouncesConsumed = ingredient.ouncesConsumed * (HomeController.currentRecipe.yield / r.yield);
                        db.updateAllTables(tempIngredient, r);
                        var myUpdatedIngredient = db.queryAllRelevantTablesSQLByIngredientName(tempIngredient);
                    }
                    recipe.yield = r.yield;
                    GetFullRecipePrice(recipe);
                    var myUpdatedIngredients = db.queryAllTablesForAllIngredients(recipe.ingredients);
                }
            }
        }
        public void AdjustTotalMeasurement19()
        {
            var convert  = new ConvertMeasurement();
            var expected = "20 eggs";
            var actual   = convert.AdjustIngredientMeasurement("5 eggs", 20, 80);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement18()
        {
            var convert  = new ConvertMeasurement();
            var expected = "1.5 eggs";
            var actual   = convert.AdjustIngredientMeasurement("3 eggs", 8, 4);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement3()
        {
            var convert  = new ConvertMeasurement();
            var expected = "1 teaspoons";
            var actual   = convert.AdjustIngredientMeasurement("1 tablespoon", 6, 2);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement()
        {
            var convert  = new ConvertMeasurement();
            var expected = "1 cups";
            var actual   = convert.AdjustIngredientMeasurement("1/2 cup", 2, 4);

            Assert.AreEqual(expected, actual);
        }
        public void TestCondenseTwoThirdsCups()
        {
            var convert  = new ConvertMeasurement();
            var expected = "2/3 cups";
            var actual   = convert.AdjustIngredientMeasurement("1/3 cup", 1, 2);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement20()
        {
            var convert  = new ConvertMeasurement();
            var expected = "16 egg whites, stiffly beaten to a meringue";
            var actual   = convert.AdjustIngredientMeasurement("8 egg whites, stiffly beaten to a meringue", 30, 60);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurements15()
        {
            var convert  = new ConvertMeasurement();
            var expected = "2 tablespoons 2 pinches";
            //var expected = ".125 cups 2 pinches";
            var actual = convert.AdjustIngredientMeasurement("1 tablespoon 1 pinch", 8, 16);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement14()
        {
            var convert  = new ConvertMeasurement();
            var expected = "1/4 cups 1 tablespoons";
            //var expected = ".25 cups 1 tablespoons";
            var actual = convert.AdjustIngredientMeasurement("1/4 cup 2 tablespoons 2 teaspoon", 8, 6);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement12()
        {
            var convert  = new ConvertMeasurement();
            var expected = "1/8 teaspoons";
            //var expected = ".125 teaspoons";
            var actual = convert.AdjustIngredientMeasurement("1/4 teaspoon", 4, 2);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement9()
        {
            var convert  = new ConvertMeasurement();
            var expected = "1 tablespoons 1 1/2 teaspoons";
            //var expected = "1 tablespoons 1.5 teaspoons";
            var actual = convert.AdjustIngredientMeasurement("3 tablespoons", 2, 1);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement5()
        {
            var convert  = new ConvertMeasurement();
            var expected = "2 cups 2 tablespoons";
            //var expected = "2.125 cups";
            var actual = convert.AdjustIngredientMeasurement("1/2 cup 1 1/2 teaspoon", 4, 16);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement2()
        {
            var convert  = new ConvertMeasurement();
            var expected = "2 tablespoons";
            //var expected = ".125 cups";
            var actual = convert.AdjustIngredientMeasurement("1/2 cup", 8, 2);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement13()
        {
            var convert  = new ConvertMeasurement();
            var expected = "2 cups 3 tablespoons 1/4 teaspoons";
            //var expected = "2 cups 3 tablespoons .25 teaspoons";
            //var expected = "2.125 cups 1 tablespoons .25 teaspoons";
            var actual = convert.AdjustIngredientMeasurement("1 cup 1 1/2 tablespoons 1/8 teaspoon", 15, 30);

            Assert.AreEqual(expected, actual);
        }
        public void AdjustTotalMeasurement4()
        {
            var convert  = new ConvertMeasurement();
            var expected = "1 cups 2 tablespoons 1 1/2 teaspoons";
            //var expected = "1 cups 2 tablespoons 1.5 teaspoons";
            //var expected = "1.125 cups 1.5 teaspoons";
            var actual = convert.AdjustIngredientMeasurement("9 1/4 tablespoons", 24, 48);

            Assert.AreEqual(expected, actual);
        }