public void BreadOrder_WillContainCostofBreadWithSpecial_Value()
        {
            Bread pricedBread   = new Bread(5, 3);
            int   breadDiscount = pricedBread.BreadOrder();

            Assert.AreEqual(10, breadDiscount);
        }
        public void BreadOrder_WillContainTotalCostofBread_Value()
        {
            Bread pricedBread = new Bread(5, 3);
            int   breadTotal  = pricedBread.BreadOrder();

            Assert.AreEqual(10, breadTotal);
        }
예제 #3
0
        public static void Main()
        {
            Console.WriteLine("Welcome to Pierre's Bakery. We bake good things.");
            Console.WriteLine("Each loaf of bread costs $5 and each pastry is $2.");
            Console.WriteLine("Our current specials are: Buy 2 Or More Loaves of Bread, Get One Free & Buy 3 Pastries for $5");
            Console.WriteLine("How many loaves of bread would you like?");
            string stringBreadOrder = Console.ReadLine();
            int    breadOrderQty    = int.Parse(stringBreadOrder);

            Console.WriteLine("How many pastries can I get you?");
            string stringPastryOrder = Console.ReadLine();
            int    pastryOrderQty    = int.Parse(stringPastryOrder);

            int breadOrder = Bread.SpecialOffer(breadOrderQty);
            int orderTotal = Bread.BreadOrder(breadOrderQty) + Pastry.PastryOrder(pastryOrderQty);

            System.Threading.Thread.Sleep(1000);
            Console.WriteLine($"Your order results in {breadOrder} loaves of bread and {pastryOrderQty} pastries. Your total comes out to ${orderTotal}.");

            Console.WriteLine("Is there anything else I can get you today? [type 'y' for yes, 'n' for no]");
            string endAnswer = Console.ReadLine();

            if (endAnswer == "y")
            {
                Main();
            }
            else
            {
                Console.WriteLine("Come see the good things we bake again soon.");
            }
        }
예제 #4
0
        public void BreadOrder_CalculatesSalePriceOfBreadOrder_Int()
        {
            int   input  = 5;
            Bread uOrder = new Bread(input);
            int   result = uOrder.BreadOrder();

            Assert.AreEqual(15, result);
        }
예제 #5
0
        public void BreadOrder_CalculateTotalCostOfBreadOrders_Int()
        {
            Bread uOrder = new Bread(5);
            Bread yOrder = new Bread(2);
            int   total  = Bread.GetAll();
            int   final  = Bread.BreadOrder(total);

            Assert.AreEqual(20, final);
        }
예제 #6
0
        public void BreadOrder_CheckOrderOfTwoLoaves_Ten()
        {
            //Arrange
            int breadOrderQty = 2;
            int orderAmount   = 10;

            //Act
            int result = Bread.BreadOrder(breadOrderQty);

            //Assert
            Assert.AreEqual(orderAmount, result);
        }
예제 #7
0
        public void BreadOrder_CheckOrderOfOneLoaf_Five()
        {
            //Arrange
            int breadOrderQty = 1;
            int orderAmount   = 5;

            //Act
            int result = Bread.BreadOrder(breadOrderQty);

            //Assert
            Assert.AreEqual(orderAmount, result);
        }