public void Total_Price_Based_On_Order_Number()
        {
            var order = _toyBlockFactory.CreateOrder("James", "123 Smith Street, Fitzroy");

            order.AddBlock(Shape.Circle, Color.Blue);
            order.AddBlock(Shape.Square, Color.Yellow);
            order.AddBlock(Shape.Triangle, Color.Red);

            var invoiceReport = _toyBlockFactory.GetInvoiceReport(1);

            Assert.Equal(7, invoiceReport.GetCostTotal());
        }
Пример #2
0
        private static void PrintInvoiceReport(ToyBlockFactory toyBlockFactory, int orderNumber)
        {
            var order = toyBlockFactory.GetOrder(orderNumber);

            Console.WriteLine("Your invoice report has been generated:");
            Console.WriteLine(
                $"Name: {order.Name} Address: {order.Address} Due Date: {order.DueDate} Order Number: {order.OrderNumber}");

            var invoiceReport = toyBlockFactory.GetInvoiceReport(orderNumber);

            PrintPaintingReport(toyBlockFactory, orderNumber);

            Console.WriteLine("");

            foreach (var shape in ToyBlockFactory.GetAvailableShapes())
            {
                Console.WriteLine($"{shape, 13}s            {order.CountShape(shape), 3} @${PriceCalculator.ShapePrices[shape], 3} ppi = ${order.CountShape(shape) * PriceCalculator.ShapePrices[shape], 2}");
            }

            foreach (var color in ToyBlockFactory.GetAvailableColors())
            {
                if (PriceCalculator.ColorPrices[color] > 0)
                {
                    Console.WriteLine($"{color, 4} color surcharge      {order.CountColor(color), 3} @${PriceCalculator.ColorPrices[color], 3} ppi = ${order.CountColor(color)*PriceCalculator.ColorPrices[color], 2}");
                }
            }
            Console.WriteLine($"Total : ${invoiceReport.GetCostTotal(), 3}");
        }
Пример #3
0
        public void Create_Invoice_Report_Will_Return_Price_Of_Order()
        {
            var order = _toyBlockFactory.CreateOrder("James", "123 Smith Street, Fitzroy");

            order.AddBlock(Shape.Circle, Color.Blue);
            order.AddBlock(Shape.Square, Color.Blue);
            order.AddBlock(Shape.Square, Color.Yellow);
            order.AddBlock(Shape.Triangle, Color.Red);

            var invoiceReport = _toyBlockFactory.GetInvoiceReport(1);

            Assert.Equal(8, invoiceReport.GetCostTotal());
        }