public void Test_PatronEatsFoodToReduceBAC() { Patron testPatron = new Patron("Kurt RockJaw", "M", 200, 72); testPatron.Save(); Drink testDrink = new Drink("The Manliest Drink", "Goat Balls", 40, 20, 4); testDrink.Save(); Drink testDrink2 = new Drink("The Manliest Drink", "Goat Balls", 40, 20, 4); testDrink2.Save(); Food testFood = new Food("BEEF", "RAW. MEAT. EAT.", 12, 2); testFood.Save(); Food testFood2 = new Food("BEEF", "RAW. MEAT. EAT.", 12, 2); testFood2.Save(); testPatron.AddDrinkAndFoodToOrdersTable(testDrink, testFood); testPatron.AddDrinkAndFoodToOrdersTable(testDrink2, testFood2); // testPatron.AddDrinkAndFoodToOrdersTable(testFood); // testPatron.AddDrinkAndFoodToOrdersTable(testFood2); decimal testPatronBAC = testPatron.GetPatronBAC(); decimal expectedBAC = Math.Round((((Convert.ToDecimal(testDrink.GetABV()) / 100M * testDrink.GetInstances()) * 5.14M) / (testPatron.GetWeight() * .73M) - (.015M * 1M) - ((testFood.GetBACRemoval() + testFood2.GetBACRemoval()) / 100)), 6); Assert.Equal(expectedBAC, testPatronBAC); }
public void Test_ReturnsPatronsBAC() { Patron testPatron = new Patron("Gary Busey", "M", 220, 72); Drink testDrink = new Drink("Long Island Iced Tea", "Mixed", 40, 10, 4); Food testFood = new Food("BEEF", "RAW. MEAT. EAT.", 12, 2); testFood.Save(); testPatron.Save(); testDrink.Save(); testPatron.AddDrinkAndFoodToOrdersTable(testDrink, testFood); decimal testPatronBAC = testPatron.GetPatronBAC(); decimal expectedBAC = Math.Round((((Convert.ToDecimal(testDrink.GetABV()) / 100M * testDrink.GetInstances()) * 5.14M) / (testPatron.GetWeight() * .73M) - (.015M * 1M)), 4); Assert.Equal(expectedBAC, testPatronBAC); }