Ejemplo n.º 1
0
        public void TestCountTypes(double all)
        {
            Product        temp = new Product();
            List <Product> list = new List <Product>();

            list.Add(new Product("pencil", "arct", 12, 1.35));
            list.Add(new Product("pencil", "arct", 12, 1.35));
            list.Add(new Product("pencl", "arct", 12, 1.35));
            CountTypes CT          = new CountTypes(list);
            double     CheckResult = CT.Calculate();

            Assert.AreEqual(CheckResult, all);
        }
Ejemplo n.º 2
0
        private void FunctionInput()
        {
            Console.WriteLine("Count types");
            Console.WriteLine("Count all");
            Console.WriteLine("Average price");
            Console.WriteLine("Average price with type");
            string comand;

            comand = Console.ReadLine();

            switch (comand)
            {
            case "Count types":
            {
                double     temp;
                CountTypes CP = new CountTypes(products);
                temp = CP.Calculate();
                Console.WriteLine(temp);
            }
            break;

            case "count types":
            {
                double     temp;
                CountTypes CP = new CountTypes(products);
                temp = CP.Calculate();
                Console.WriteLine(temp);
            }
            break;

            case "Count all":
            {
                double   temp;
                CountAll CA = new CountAll(products);
                temp = CA.Calculate();
                Console.WriteLine(temp);
            }
            break;

            case "count all":
            {
                double   temp;
                CountAll CA = new CountAll(products);
                temp = CA.Calculate();
                Console.WriteLine(temp);
            }
            break;

            case "Average price":
            {
                double       price;
                AveragePrice AP = new AveragePrice(products);
                price = AP.Calculate();
                Console.WriteLine(price);
            }
            break;

            case "average price":
            {
                double       price;
                AveragePrice AP = new AveragePrice(products);
                price = AP.Calculate();
                Console.WriteLine(price);
            }
            break;

            case "Average price with type":
            {
                double price;
                AveragePriceWithType APWT = new AveragePriceWithType(products);
                price = APWT.Calculate();
                Console.WriteLine(price);
            }
            break;

            case "average price with type":
            {
                double price;
                AveragePriceWithType APWT = new AveragePriceWithType(products);
                price = APWT.Calculate();
                Console.WriteLine(price);
            }
            break;

            default:
            {
                Console.WriteLine("check that the command is correct");
                return;
            }
            }
        }