예제 #1
0
        public void CalculateBreadCost_CalculatesCostOfBreadOrderInput0_void()
        {
            Bread newBread = new Bread(0);

            newBread.CalculateBreadCost();
            Assert.AreEqual(0, newBread.Cost);
        }
        public void CalculateBreadCostIfDeal_ReturnBreadCostWithDiscount_Double()
        {
            int    amount   = 11;
            double price    = 5;
            Bread  newBread = new Bread(price, true);

            double result = newBread.CalculateBreadCost(amount);

            Assert.AreEqual((amount - amount / 3) * price, result);
        }
        public void CalculateBreadCost_ReturnBreadCost_Double()
        {
            double price    = 4.49;
            Bread  newBread = new Bread(price);
            int    amount   = 3;

            double result = newBread.CalculateBreadCost(amount);

            Assert.AreEqual(amount * price, result);
        }
예제 #4
0
    public static void Main()
    {
        Bread  bakeryBread  = new Bread();
        Pastry bakeryPastry = new Pastry();

        while (true)
        {
            OutputMenu();
            PurchaseSequence();
            WriteLine("Are you ready to checkout? (y/n)");
            string response = ReadLine();
            if (response.ToLower() == "y")
            {
                _total += bakeryBread.CalculateBreadCost(itemsOrdered["bread"]);
                _total += bakeryPastry.CalculatePastryCost(itemsOrdered["pastry"]);
                WriteLine("-----------------------");
                WriteLine($"Your total is ${_total}");
                WriteLine("-----------------------");
                break;
            }
        }
    }
예제 #5
0
        public void CalculateCost_CalculateSevenBreadOrderCost_Integer()
        {
            Bread bread = new Bread("multigrain", 7, 5);

            Assert.AreEqual(25, bread.CalculateBreadCost());
        }
예제 #6
0
        public void CalculateCost_CalculateThreeBreadOrderCost_Integer()
        {
            Bread bread = new Bread("multigrain", 3, 5);

            Assert.AreEqual(10, bread.CalculateBreadCost());
        }
예제 #7
0
 static double CalculateTotalCost(int breadAmount, int pastryAmount, Bread newBread, Pastry newPastry)
 {
     return(newBread.CalculateBreadCost(breadAmount) + newPastry.CalculatePastryCost(pastryAmount));
 }
예제 #8
0
        public void SingleLoaf_BreadCostTest()
        {
            int costForOneLoaf = testBread.CalculateBreadCost(1);

            Assert.AreEqual(5, costForOneLoaf);
        }