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}");
        }
        private static void PrintCuttingReport(ToyBlockFactory toyBlockFactory, int orderNumber)
        {
            var order = toyBlockFactory.GetOrder(orderNumber);

            Console.WriteLine("Your cutting list has been generated:");
            Console.WriteLine(
                $"Name: {order.Name} Address: {order.Address} Due Date: {order.DueDate} Order Number: {order.OrderNumber}");
            Console.WriteLine($"|{"",10}|{" Qty ",4}|");
            Console.WriteLine($"|{"----------",10}|{"-----",4}|");

            var cuttingReport = toyBlockFactory.GetCuttingReport(orderNumber);

            foreach (var shape in ToyBlockFactory.GetAvailableShapes())
            {
                Console.Write($"|{shape,10}|");

                if (cuttingReport.GetShapeTotal(shape) > 0)
                {
                    Console.Write($"{cuttingReport.GetShapeTotal(shape),5}|");
                }
                else if (cuttingReport.GetShapeTotal(shape) == 0)
                {
                    Console.Write($"{"-", 4} |");
                }
                Console.WriteLine("");
            }
        }
Example #3
0
        public void Can_Retrieve_Order()
        {
            var order = _toyBlockFactory.CreateOrder("James", "123 Smith Street, Fitzroy");

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

            Assert.Equal("James", _toyBlockFactory.GetOrder(1).Name);
        }
        private static void PrintPaintingReport(ToyBlockFactory toyBlockFactory, int orderNumber)
        {
            var order = toyBlockFactory.GetOrder(orderNumber);

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

            var paintingReport = toyBlockFactory.GetPaintingReport(orderNumber);

            Console.Write($"|{"          ",10}|");

            foreach (var color in ToyBlockFactory.GetAvailableColors())
            {
                Console.Write($"{color,6} |");
            }

            Console.WriteLine("");

            Console.Write($"|{"----------",10}|");
            foreach (var color in ToyBlockFactory.GetAvailableColors())
            {
                Console.Write($"{"-----",6} |");
            }

            Console.WriteLine("");

            foreach (var shape in ToyBlockFactory.GetAvailableShapes())
            {
                Console.Write($"|{shape,10}|");

                foreach (var color in ToyBlockFactory.GetAvailableColors())
                {
                    if (paintingReport.GetShapeColorTotal(shape, color) > 0)
                    {
                        Console.Write($"{paintingReport.GetShapeColorTotal(shape, color), 6} |");
                    }
                    else if (paintingReport.GetShapeColorTotal(shape, color) == 0)
                    {
                        Console.Write($"{"-", 6} |");
                    }
                }
                Console.WriteLine("");
            }
        }
Example #5
0
        public void Placing_An_Order_Will_Create_New_Order()
        {
            var order = _toyBlockFactory.CreateOrder("James", "123 Smith Street, Fitzroy");

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

            Assert.Equal("James", order.Name);
            Assert.Equal("123 Smith Street, Fitzroy", order.Address);
            Assert.Equal(DateTime.Today.AddDays(7), order.DueDate);
            Assert.Equal(1, order.OrderNumber);
            Assert.Equal(1, order.CountShape(Shape.Circle));
            Assert.Equal(1, order.CountColor(Color.Red));

            Assert.Equal(OrderStatus.New, _toyBlockFactory.GetOrderStatus(1));
            Assert.Equal("James", _toyBlockFactory.GetOrder(1).Name);
        }