private static void SalesReportBuilderTest()
        {
            FakeOrdersService   ordersService      = new FakeOrdersService();
            IEnumerable <Order> orders             = ordersService.Get();
            ISalesReportBuilder salesReportBuilder = new SalesReportBuilder(orders);

            salesReportBuilder.AddHeader();
            salesReportBuilder.AddSectionByGender();
            salesReportBuilder.AddSectionByProduct();

            SalesReport salesReport = salesReportBuilder.Build();
        }
Esempio n. 2
0
        private static void SalesReportTest()
        {
            FakeOrdersService   ordersService = new FakeOrdersService();
            IEnumerable <Order> orders        = ordersService.Get();

            ISalesReportBuilder salesReportBuilder = new SalesReportBuilder(orders);

            salesReportBuilder.AddHeader();

            if (true)
            {
                salesReportBuilder.AddSectionByGender();
            }


            salesReportBuilder.AddSectionByProduct();

            SalesReport salesReport = salesReportBuilder.Build();


            //SalesReport salesReport = new SalesReport();
            //salesReport.Title = "Raport sprzedaży";
            //salesReport.CreateDate = DateTime.Now;
            //salesReport.TotalSalesAmount = orders.Sum(s => s.Amount);

            //salesReport.GenderDetails = orders
            //    .GroupBy(o => o.Customer.Gender)
            //    .Select(g => new GenderReportDetail(
            //                g.Key,
            //                g.Sum(x => x.Details.Sum(d => d.Quantity)),
            //                g.Sum(x => x.Details.Sum(d => d.LineTotal))));

            //salesReport.ProductDetails = orders
            //    .SelectMany(o => o.Details)
            //    .GroupBy(o => o.Product)
            //    .Select(g => new ProductReportDetail(g.Key, g.Sum(p => p.Quantity), g.Sum(p => p.LineTotal)));

            Console.WriteLine(salesReport);
        }