Example #1
0
        public void TestAveragePriceCalc(string TestName, double price)
        {
            Product        temp = new Product();
            List <Product> list = new List <Product>();

            list.Add(new Product("pencil", "arct", 12, 1.35));
            AveragePriceWithType APWT = new AveragePriceWithType(list);
            double CheckResult        = APWT.Calculate();

            Assert.AreEqual(CheckResult, price);
        }
Example #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;
            }
            }
        }