Exemple #1
0
        public void TestChocolateChips()
        {
            var dbD = new DatabaseAccessDensityInformation();
            var dbR = new DatabaseAccessRecipe();
            var t   = new DatabaseAccess();
            var r   = new Recipe("Chooalte Chip Cookies")
            {
                id = 1
            };
            var i = new Ingredient("Semi Sweet Morsels")
            {
                ingredientId = 1, recipeId = 1, sellingWeight = "36 oz", density = 5.35m, measurement = "1 cup"
            };

            //6.98    1.04
            t.initializeDatabase();
            //var filename = @"C:\Users\Rachel\Documents\Visual Studio 2015\Projects\RachelsRosesWebPages\RachelsRosesWebPages\densityTxtDatabase.txt";
            dbD.insertDensityTextFileIntoDensityInfoDatabase();
            t.insertIngredientIntoAllTables(i, r);
            var mydensityDataInformation = dbD.queryDensityInfoTable();
            var semiSweetMorsels         = t.queryAllRelevantTablesSQLByIngredientName(i);
            var myRecipes = dbR.MyRecipeBox();

            Assert.AreEqual("all purpose flour", mydensityDataInformation[0].name);
            Assert.AreEqual(1, myRecipes.Count());
            Assert.AreEqual(6.98m, semiSweetMorsels.sellingPrice);
            Assert.AreEqual(6.98m, myRecipes[0].ingredients[0].sellingPrice);
            Assert.AreEqual(1.04m, semiSweetMorsels.priceOfMeasuredConsumption);
            Assert.AreEqual(1.04m, myRecipes[0].ingredients[0].priceOfMeasuredConsumption);
        }
        public void TestGetDensityTableInformationFromDensityTable()
        {
            var t             = new DatabaseAccess();
            var dbD           = new DatabaseAccessDensities();
            var dbDI          = new DatabaseAccessDensityInformation();
            var chocolateCake = new Recipe("Chocolate Cake")
            {
                id = 1, yield = 20
            };
            var cakeFlour = new Ingredient("Softasilk Cake Flour")
            {
                ingredientId = 1, recipeId = 1, sellingWeight = "32 oz", classification = "flour", typeOfIngredient = "cake flour", measurement = "2 cups 2 tablespoons", density = 4.5m, pricePerOunce = .0931m
            };

            t.initializeDatabase();
            dbDI.insertDensityTextFileIntoDensityInfoDatabase();
            dbD.insertIngredientDensityData(cakeFlour);
            var myIngrededientTableInformation = dbD.queryIngredientFromDensityTableByName(cakeFlour);

            Assert.AreEqual(1, myIngrededientTableInformation.ingredientId);
            Assert.AreEqual("32 oz", myIngrededientTableInformation.sellingWeight);
            Assert.AreEqual(32m, myIngrededientTableInformation.sellingWeightInOunces);
            Assert.AreEqual(2.98m, myIngrededientTableInformation.sellingPrice);
            Assert.AreEqual(4.5m, myIngrededientTableInformation.density);
            Assert.AreEqual(.0931m, myIngrededientTableInformation.pricePerOunce);
        }
Exemple #3
0
        public void TestQueryDensityTableDensityByName2()
        {
            var db   = new DatabaseAccess();
            var dbDI = new DatabaseAccessDensityInformation();
            var softasilkCakeFlour = new Ingredient("Softasilk Cake Flour")
            {
                typeOfIngredient = "cake flour"
            };

            db.initializeDatabase();
            dbDI.insertDensityTextFileIntoDensityInfoDatabase();
            var myIngredientDensityInfo = dbDI.queryDensityTableRowDensityValueByName(softasilkCakeFlour);

            Assert.AreEqual(4.5m, myIngredientDensityInfo);
        }
Exemple #4
0
        public void TestQueryDensityTableDensityByName()
        {
            var db    = new DatabaseAccess();
            var dbDI  = new DatabaseAccessDensityInformation();
            var flour = new Ingredient("All Purpose Flour")
            {
                density = 5m
            };

            db.initializeDatabase();
            dbDI.insertDensityTextFileIntoDensityInfoDatabase();
            var myIngredientDensityInfo = dbDI.queryDensityTableRowDensityValueByName(flour);

            Assert.AreEqual(5m, myIngredientDensityInfo);
        }
Exemple #5
0
        public void TestInsertFileIntoDensityDatabase()
        {
            var t    = new DatabaseAccess();
            var dbDI = new DatabaseAccessDensityInformation();
            var read = new Reader();

            t.initializeDatabase();
            dbDI.insertDensityTextFileIntoDensityInfoDatabase();
            var myDensityInformationIngredients = dbDI.queryDensityInfoTable();

            Assert.AreEqual(41, myDensityInformationIngredients.Count());
            Assert.AreEqual("all purpose flour", myDensityInformationIngredients[0].name);
            Assert.AreEqual(5m, myDensityInformationIngredients[0].density);
            Assert.AreEqual("bananas, mashed", myDensityInformationIngredients[39].name);
            Assert.AreEqual(12m, myDensityInformationIngredients[39].density);
        }
        public void TestQueryCostTableRowByName()
        {
            var db      = new DatabaseAccess();
            var dbI     = new DatabaseAccessIngredient();
            var dbC     = new DatabaseAccessConsumption();
            var dbDI    = new DatabaseAccessDensityInformation();
            var dbD     = new DatabaseAccessDensities();
            var dbCosts = new DatabaseAccessCosts();
            var cake    = new Recipe("Cake")
            {
                id = 1, yield = 12
            };
            var softasilkCakeFlour = new Ingredient("Softasilk Cake Flour")
            {
                ingredientId = 1, recipeId = 1, sellingWeight = "32 oz", measurement = "1 1/2 cups", typeOfIngredient = "cake flour", classification = "flour"
            };

            db.initializeDatabase();
            dbDI.insertDensityTextFileIntoDensityInfoDatabase();
            dbDI.queryDensityInfoTable();
            dbI.insertIngredient(softasilkCakeFlour, cake);
            var myIngredientInformation = dbI.queryIngredientFromIngredientsTableByName(softasilkCakeFlour);

            dbD.insertIngredientDensityData(softasilkCakeFlour);
            var myIngredientDensityInformation = dbD.queryIngredientFromDensityTableByName(softasilkCakeFlour);

            dbC.insertIngredientConsumtionData(softasilkCakeFlour);
            var myIngredientConsumptionInformation = dbC.queryConsumptionTableRowByName(softasilkCakeFlour);

            //i'm getting 0 for ounces remaining still... i need to figure that one out
            dbCosts.insertIngredientCostDataCostTable(softasilkCakeFlour);
            var myCostIngredientInformation = dbCosts.queryCostsTableByName(softasilkCakeFlour);

            Assert.AreEqual("Softasilk Cake Flour", myCostIngredientInformation.name);
            Assert.AreEqual(2.98m, myCostIngredientInformation.sellingPrice);
            Assert.AreEqual(.0931m, myCostIngredientInformation.pricePerOunce);
            Assert.AreEqual("32 oz", myCostIngredientInformation.sellingWeight);
        }