public void TestInsertIngredientIntoConsumptionOuncesConsumedTable() { var db = new DatabaseAccess(); var dbI = new DatabaseAccessIngredient(); var dbC = new DatabaseAccessConsumption(); var dbCOC = new DatabaseAccessConsumptionOuncesConsumed(); var cake = new Recipe("Cake") { id = 1, yield = 24 }; var bakingPowder = new Ingredient("Baking Powder") { ingredientId = 2, recipeId = 1, measurement = "1 tablespoon", sellingWeight = "10 oz", typeOfIngredient = "baking powder", classification = "rising agent" }; var cakeFlour = new Ingredient("Softasilk Cake Flour") { ingredientId = 1, recipeId = 1, measurement = "2 cups", sellingWeight = "32 oz", typeOfIngredient = "cake flour", classification = "flour" }; db.initializeDatabase(); db.insertIngredientIntoAllTables(cakeFlour, cake); db.insertIngredientIntoAllTables(bakingPowder, cake); var myConsumptionOuncesConsumedTable = dbCOC.queryConsumptionOuncesConsumed(); Assert.AreEqual("Softasilk Cake Flour", myConsumptionOuncesConsumedTable[0].name); Assert.AreEqual("2 cups", myConsumptionOuncesConsumedTable[0].measurement); Assert.AreEqual(9m, myConsumptionOuncesConsumedTable[0].ouncesConsumed); Assert.AreEqual(23m, myConsumptionOuncesConsumedTable[0].ouncesRemaining); Assert.AreEqual("Baking Powder", myConsumptionOuncesConsumedTable[1].name); Assert.AreEqual("1 tablespoon", myConsumptionOuncesConsumedTable[1].measurement); Assert.AreEqual(.52m, myConsumptionOuncesConsumedTable[1].ouncesConsumed); Assert.AreEqual(9.48m, myConsumptionOuncesConsumedTable[1].ouncesRemaining); }
public void TestConsumptionOuncesConsumedTable() { var t = new DatabaseAccess(); var dbCOC = new DatabaseAccessConsumptionOuncesConsumed(); var cake = new Recipe("Cake") { id = 1, yield = 24 }; var cakeFlour = new Ingredient("Cake Flour") { ingredientId = 1, recipeId = 1, measurement = "1 1/2 cups", sellingWeight = "32 oz", typeOfIngredient = "cake flour", classification = "flour" }; t.initializeDatabase(); t.insertIngredientIntoAllTables(cakeFlour, cake); var myIngredients = dbCOC.queryConsumptionOuncesConsumed(); Assert.AreEqual(6.75m, myIngredients[0].ouncesConsumed); Assert.AreEqual(25.25m, myIngredients[0].ouncesRemaining); }