Пример #1
0
    public static void Main()
    {
        BakeryBread  breadOrder  = new BakeryBread();
        BakeryPastry pastryOrder = new BakeryPastry();
        ShoppingCart order       = new ShoppingCart(0, 0, 0);

        Console.WriteLine("Welcome to Pierre's Bakery! We have 2 special deals for you today: Bread is buy 2, get 1 free, and pastries are 3 for $5!");
        Console.WriteLine("Our regular prices are 1 loaf of bread is $5, and pastries are $2 each.");
        Console.WriteLine("Now, what can I get for you? Make sure you include any free loaves in your order!");

        order.BreadCount  = Program.checkInput("Bread");
        order.PastryCount = Program.checkInput("Pastries");
        order.OrderPrice  = breadOrder.GetBreadPrice(order.BreadCount) + pastryOrder.GetPastryPrice(order.PastryCount);

        Console.WriteLine($"Your total price for {order.BreadCount} loaves of bread, and {order.PastryCount} pastries is:");
        Console.ForegroundColor = ConsoleColor.Green;
        Console.WriteLine($"${order.OrderPrice}");
        Console.ResetColor();
    }
Пример #2
0
        public void BakeryPastry_GetSinglePrice()
        {
            BakeryPastry testBakeryPastry = new BakeryPastry();

            Assert.AreEqual(2, testBakeryPastry.GetPastryPrice(1));
        }
Пример #3
0
        public void BakeryPastry_GetTriplePrice()
        {
            BakeryPastry testBakeryPastry = new BakeryPastry();

            Assert.AreEqual(5, testBakeryPastry.GetPastryPrice(3));
        }