コード例 #1
0
ファイル: Bread.Tests.cs プロジェクト: fetonecontrol/bakery
        public void Bread_CalculatePastryOrderPrice_BreadPrice()
        {
            int   loaves     = 32;
            Bread BreadOrder = new Bread(loaves);

            Assert.AreEqual(110, BreadOrder.BreadPrice());
        }
コード例 #2
0
 public void BreadPrice_CalculateBreadSubtotalForMultipleOf3_True()
 {
     Bread.BreadDefault();
     Bread.GetBread()[0].Quantity = 3;
     Bread.GetBread()[1].Quantity = 3;
     Bread.GetBread()[2].Quantity = 3;
     Assert.AreEqual(30, Bread.BreadPrice());
 }
コード例 #3
0
 public static void CartReport()
 {
     Console.WriteLine("---------------------------------------------");
     if (Bread.BreadCount() == 0 && Pastry.PastryCount() == 0)
     {
         EmptyCart();
     }
     else
     {
         Console.WriteLine("Your shopping cart contains...");
         Bread.DisplayBreadList();
         Pastry.DisplayPastryList();
         Console.WriteLine("Your total comes to...");
         Console.WriteLine("$" + (Bread.BreadPrice() + Pastry.PastryPrice()));
     }
 }
コード例 #4
0
 public void BreadPrice_ShowPriceFor3LoavesOfBread_10()
 {
     Assert.AreEqual(10, Bread.BreadPrice(3));
 }
コード例 #5
0
 public void BreadPrice_ShowPriceForSingleLoaf_5()
 {
     Assert.AreEqual(5, Bread.BreadPrice(1));
 }
コード例 #6
0
ファイル: Bread.Tests.cs プロジェクト: harzulu/PierresBakery
        public void BreadPrice_ReturnPriceOfBread_5()
        {
            Bread testBread = new Bread(7);

            Assert.AreEqual(5, testBread.BreadPrice());
        }
コード例 #7
0
 public void BreadPrice_CalculateBreadSubtotalForSingleLoaf_True()
 {
     Bread.BreadDefault();
     Bread.GetBread()[0].Quantity = 1;
     Assert.AreEqual(5, Bread.BreadPrice());
 }
コード例 #8
0
        public static void Main()
        {
            Bread  bread  = new Bread(0, 0);
            Pastry pastry = new Pastry(0, 0);
            Bagel  bagel  = new Bagel(0, 0);

            Console.WriteLine("Bonjour! Welcome to Pierre's Bakery! What would you like today mon ami? Can I start you off with some bread? (Please enter yes or no!)");
            string userInputFirst = Console.ReadLine().ToLower();

            {
                if (userInputFirst == "yes")
                {
                    Console.WriteLine("Here's what we've got for bread mo' friar: 1 loaf: $5, but if you buy 2, you get 1 free! Please enter the number you'd like!");
                    string userInputBread = Console.ReadLine();
                    bread.Quant += int.Parse(userInputBread);
                    bread.Price  = Bread.BreadPrice(bread.Quant);
                    Console.WriteLine("Great! Your total for this delicious bread is $" + bread.Price);
                }
                else if (userInputFirst == "no")
                {
                    ;
                }
            }
            Console.WriteLine("Wonderful! Would you like any Pastries today? (Yes/No)");
            string userInputSecond = Console.ReadLine().ToLower();

            {
                if (userInputSecond == "yes")
                {
                    Console.WriteLine("Here are the details for pastries: 1 pastry: $2, but if one buys 3, you can get them for a total of 5$! This is to your liking, non? Go on! Enter a value!");
                    string userInputPastry = Console.ReadLine();
                    pastry.Quant += int.Parse(userInputPastry);
                    pastry.Price  = Pastry.PastryPrice(pastry.Quant);
                    Console.WriteLine("Excellent! The total for these delicious pastries is $" + pastry.Price);
                }
                else if (userInputSecond == "no")
                {
                    ;
                }
            }
            Console.WriteLine("Tres Bon! And finally would you like some bagels? Our newest special is 4 for $4! (Yes/No)");
            string userInputThird = Console.ReadLine().ToLower();

            {
                if (userInputThird == "yes")
                {
                    Console.WriteLine("Excellent choice mon friar! How many would you like? Our newest deal is 4 for $4!");
                    string userInputBagel = Console.ReadLine();
                    bagel.Quant += int.Parse(userInputBagel);
                    bagel.Price  = Bagel.BagelPrice(bagel.Quant);
                    Console.WriteLine("Ahhh magnifique! Your total for these fresh bagels will be $" + bagel.Price);
                }
                else if (userInputThird == "no")
                {
                    ;
                }
            }
            Console.WriteLine("Anything else for you? If so type yes! If not, type 'done'!");
            string userInputFinal = Console.ReadLine().ToLower();

            if (userInputFinal == "yes")
            {
                Main();
            }
            else if (userInputFinal == "done")
            {
                int total = bread.Price + pastry.Price;
                Console.WriteLine("Fantastique! Your total is: $" + total);
                Console.WriteLine("Thank you for visiting mon ami! Please come again, and aou revuare!");
            }
            else
            {
                Console.WriteLine("Please enter a valid value!");
            }
        }