예제 #1
0
파일: BakeryTests.cs 프로젝트: 3Emme/Bakery
        public void BreadCost_BuyTwoGetOneFree_3and10()
        {
            Bread newBread = new Bread(2);

            Assert.AreEqual(3, newBread.BreadCost()[0]);
            Assert.AreEqual(10, newBread.BreadCost()[1]);
        }
예제 #2
0
파일: BakeryTests.cs 프로젝트: 3Emme/Bakery
        public void BreadCost_BuyOne_1and5()
        {
            Bread newBread = new Bread(1);

            Assert.AreEqual(1, newBread.BreadCost()[0]);
            Assert.AreEqual(5, newBread.BreadCost()[1]);
        }
예제 #3
0
파일: BakeryTests.cs 프로젝트: 3Emme/Bakery
        public void BreadCost_BuyThreePayForTwo_3and10()
        {
            Bread newBread = new Bread(3);

            Assert.AreEqual(3, newBread.BreadCost()[0]);
            Assert.AreEqual(10, newBread.BreadCost()[1]);
        }
예제 #4
0
        public void BreadCost_GetCorrectCostOfMultipleBread_Int()
        {
            int testBread     = 4;
            int testBreadCost = Bread.BreadCost(testBread);

            Assert.AreEqual(10, testBreadCost);
        }
예제 #5
0
        public void BreadCost_BuyOneLoaf_Five()
        {
            Bread testBread = new Bread();
            int   quantity  = 1;

            Assert.AreEqual(5, testBread.BreadCost(quantity, 0));
        }
예제 #6
0
        public void BreadCost_3LoavesAtBuy2Get1FreeAt5Each_Ten()
        {
            Bread testBread = new Bread();
            int   quantity  = 3;

            Assert.AreEqual(10, testBread.BreadCost(quantity, 0));
        }
예제 #7
0
        public void BreadCost_7LoavesAtBuy2Get1FreeAt5Each_TwentyFive()
        {
            Bread testBread = new Bread();
            int   quantity  = 7;

            Assert.AreEqual(25, testBread.BreadCost(quantity, 0));
        }
예제 #8
0
        public void BreadCost_GetCorrectCostOfOneBread_Int()
        {
            int testBread     = 1;
            int testBreadCost = Bread.BreadCost(testBread);

            Assert.AreEqual(5, testBreadCost);
        }
예제 #9
0
        public void BreadCost_BuyOneBreadEach_Eleven()
        {
            Bread testBread = new Bread();
            int   quantity1 = 1;
            int   quantity2 = 1;

            Assert.AreEqual(11, testBread.BreadCost(quantity1, quantity2));
        }
예제 #10
0
        public void BreadCost_Buy2Get1FreeAndBuy3Get1Free_TwentyEight()
        {
            Bread testBread = new Bread();
            int   quantity1 = 3;
            int   quantity2 = 4;

            Assert.AreEqual(28, testBread.BreadCost(quantity1, quantity2));
        }
예제 #11
0
        public void BreadCost_Buy2Get1FreeAndBuy3Get1Free_SixtySeven()
        {
            Bread testBread = new Bread();
            int   quantity1 = 7;
            int   quantity2 = 9;

            Assert.AreEqual(67, testBread.BreadCost(quantity1, quantity2));
        }
예제 #12
0
        public void BreadCost_GetBreadDealPrice_Int()
        {
            int    inputBreadQuantity = 3;
            string inputBreadType     = "rye";
            int    breadCostTest      = 10;
            Bread  newBread           = new Bread(inputBreadQuantity, inputBreadType);

            int breadCost = newBread.BreadCost();

            Assert.AreEqual(breadCostTest, breadCost);
        }
예제 #13
0
        public static void Main()
        {
            Console.WriteLine("Welcome to Pierre's Bakery: One bread for $5 and one pastry for $2");

            Console.WriteLine("type your number of bread in to see your price: ");
            string input  = Console.ReadLine();
            int    inputP = int.Parse(input);

            Bread myBreadOrder = new Bread();

            Console.WriteLine($"The bread's price: {myBreadOrder.BreadCost(inputP)}  and  get { myBreadOrder.TotalBread()} free");

            Console.WriteLine("type your number of pastry in to see your price: ");
            string result  = Console.ReadLine();
            int    resultP = int.Parse(result);

            Console.WriteLine($"The  pastry's price: {Pastry.pastryCost(resultP)}");
            int total = myBreadOrder.BreadCost(inputP) + Pastry.pastryCost(resultP);

            Console.WriteLine("The total price: " + total);
        }
예제 #14
0
 public int GetTotalCost()
 {
     return(Bread.BreadCost(_breadOrder) + Pastry.PastryCost(_pastryOrder) + Fable.FableCost(_fableOrder));
 }
예제 #15
0
 public void BreadCost_CorrectlyCalcPriceFor1Loaf_5()
 {
     Assert.AreEqual(5, Bread.BreadCost(1));
 }
예제 #16
0
 public void BreadCost_CorrectlyCalcPriceFor3Loaf_10()
 {
     Assert.AreEqual(10, Bread.BreadCost(3));
 }
예제 #17
0
        public void GetNumber_ReturnNumber_int()
        {
            Bread orderBread = new Bread();

            Assert.AreEqual(5, orderBread.BreadCost(1));
        }
예제 #18
0
        public void BakeryCost_BreadCostsFiveDollars_True()
        {
            Bread testBread = new Bread();

            Assert.AreEqual(true, testBread.BreadCost(5));
        }
예제 #19
0
        public void Bread_CalculateDiscountForMore_int()
        {
            Bread testBreadOrder = new Bread(10);

            Assert.AreEqual(35, testBreadOrder.BreadCost());
        }
예제 #20
0
        public void Bread_CalculateDiscount_int()
        {
            Bread testBreadOrder = new Bread(3);

            Assert.AreEqual(10, testBreadOrder.BreadCost());
        }
예제 #21
0
    static void Main()
    {
        int breadTotal             = 0;
        int pastryTotal            = 0;
        int twentyOneGrainQuantity = 0;
        int powerseedQuantity      = 0;
        int doughnutQuantity       = 0;
        int muffinQuantity         = 0;

        Console.WriteLine("Welcome to Pierre's Bakery! The best baked goods in town!");
        Console.WriteLine("We sell bread and we sell pastries.");
        Console.ForegroundColor = ConsoleColor.Cyan;
        Console.WriteLine("Would you like to buy any bread today? Twenty One Grain is $5 each or buy 2, get 1 free and Powerseed is $6 each or buy 3, get 1 free.");
        Console.ForegroundColor = ConsoleColor.White;
        string buyBreadResponse = Console.ReadLine().ToLower();

        if (buyBreadResponse.Substring(0, 1) == "y")
        {
            System.Threading.Thread.Sleep(800);
            Console.WriteLine("-------------------------------------------------------------------------------------");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("Very good! What type of bread would you like? Twenty One Grain or Powerseed or both?");
            Console.ForegroundColor = ConsoleColor.White;
            string breadType = Console.ReadLine().ToLower();

            if (breadType.Substring(0, 1) == "b")
            {
                System.Threading.Thread.Sleep(600);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("How many loaves of 21 Grain bread would you like?");
                Console.ForegroundColor = ConsoleColor.White;
                twentyOneGrainQuantity  = int.Parse(Console.ReadLine());
                System.Threading.Thread.Sleep(600);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("How many loaves of Powerseed bread would you like?");
                Console.ForegroundColor = ConsoleColor.White;
                powerseedQuantity       = int.Parse(Console.ReadLine());
            }
            else if (breadType.Substring(0, 1) == "p")
            {
                System.Threading.Thread.Sleep(600);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("How many loaves of Powerseed bread would you like?");
                Console.ForegroundColor = ConsoleColor.White;
                powerseedQuantity       = int.Parse(Console.ReadLine());
            }
            else if (breadType.Substring(0, 1) == "t")
            {
                System.Threading.Thread.Sleep(600);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("How many loaves of 21 Grain bread would you like?");
                Console.ForegroundColor = ConsoleColor.White;
                twentyOneGrainQuantity  = int.Parse(Console.ReadLine());
            }
            Console.WriteLine("----------");
            Console.WriteLine("Excellent!");
            Bread newBread = new Bread();
            breadTotal = newBread.BreadCost(twentyOneGrainQuantity, powerseedQuantity);
            System.Threading.Thread.Sleep(600);
        }
        System.Threading.Thread.Sleep(600);
        Console.ForegroundColor = ConsoleColor.Cyan;
        Console.WriteLine("Would you like to buy any Pastries today? Doughnuts are $1 each or 3 for $2 and muffins are $2 each or 3 for $5.");
        Console.ForegroundColor = ConsoleColor.White;
        string buyPastryResponse = Console.ReadLine().ToLower();

        if (buyPastryResponse.Substring(0, 1) == "y")
        {
            System.Threading.Thread.Sleep(800);
            Console.WriteLine("-----------------------------------------------------");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("Very good! Would you like doughnuts, muffins or both?");
            Console.ForegroundColor = ConsoleColor.White;
            string pastryTypeResponse = Console.ReadLine().ToLower();
            if (pastryTypeResponse.Substring(0, 1) == "b")
            {
                System.Threading.Thread.Sleep(600);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("How many doughnuts would you like?");
                Console.ForegroundColor = ConsoleColor.White;
                doughnutQuantity        = int.Parse(Console.ReadLine());
                System.Threading.Thread.Sleep(600);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("How many muffins would you like?");
                Console.ForegroundColor = ConsoleColor.White;
                muffinQuantity          = int.Parse(Console.ReadLine());
            }
            else if (pastryTypeResponse.Substring(0, 1) == "d")
            {
                System.Threading.Thread.Sleep(600);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("How many doughnuts would you like?");
                Console.ForegroundColor = ConsoleColor.White;
                doughnutQuantity        = int.Parse(Console.ReadLine());
            }
            else if (pastryTypeResponse.Substring(0, 1) == "m")
            {
                System.Threading.Thread.Sleep(600);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("How many muffins would you like?");
                Console.ForegroundColor = ConsoleColor.White;
                muffinQuantity          = int.Parse(Console.ReadLine());
            }
            Console.WriteLine("----------");
            Console.WriteLine("Excellent!");
            Pastry newPastry = new Pastry();
            pastryTotal = newPastry.PastryCost(doughnutQuantity, muffinQuantity);
            System.Threading.Thread.Sleep(800);
        }
        int purchaseTotal = breadTotal + pastryTotal;

        if (purchaseTotal == 0)
        {
            System.Threading.Thread.Sleep(800);
            Console.WriteLine("------------------------------------------------------------------------------");
            Console.WriteLine("We are sorry to see you go without any delicious baked goods! Have a nice day!");
        }
        else
        {
            System.Threading.Thread.Sleep(800);
            Console.WriteLine("-----------------------");
            Console.WriteLine("You total today is " + "$" + purchaseTotal + ".");
            System.Threading.Thread.Sleep(1700);
            Console.WriteLine("-----------------------------");
            Console.WriteLine("(Money is being exchanged...)");
            Console.WriteLine("-----------------------------");
            System.Threading.Thread.Sleep(2000);
            Console.WriteLine("We really appreciate you coming in today!");
        }
    }
예제 #22
0
        public void Bread_CalculateCost_int()
        {
            Bread testBreadOrder = new Bread(1);

            Assert.AreEqual(5, testBreadOrder.BreadCost());
        }