Esempio n. 1
0
        public static void StoreViewSalesAndRevenue(Store store)
        {
            Console.WriteLine("================================");
            Console.WriteLine("");
            List <Order> listOrders = _or.Get(store);

            if (listOrders.Count == 0)
            {
                Console.WriteLine("You don't have any sales so far");
                Console.WriteLine("");
            }
            else
            {
                Console.WriteLine("SALES AND REVENUE OF ALL TIME");
                Console.WriteLine("------------------------------");
                Console.WriteLine("");
                decimal totalRevenue = 0;
                int     totalAmount  = 0;
                Dictionary <long, int> RepeatedPizzaSales = _opr.CalculateSalesAndRevenue(listOrders);
                foreach (var p in RepeatedPizzaSales)
                {
                    totalAmount += p.Value;
                    int     amount    = p.Value;
                    string  namePizza = _pr.GetName(p.Key);
                    decimal price     = _pr.GetPrice(p.Key);
                    totalRevenue += amount * price;
                    decimal revenue = amount * price;
                    Console.WriteLine($"{amount} {namePizza} ${revenue}");
                }

                Console.WriteLine("");
                Console.WriteLine($"TOTAL NUMBER OF PIZZAS SOLD: {totalAmount}");
                Console.WriteLine($"TOTAL REVENUE: ${totalRevenue}");
                Console.WriteLine("");
            }
        }
Esempio n. 2
0
        public void Test_RepositoryGetName(int l)
        {
            var actual = sut.GetName(l);

            Assert.IsType <string>(actual);
        }