Esempio n. 1
0
        static void Main(string[] args)
        {
            var                  path                = @"C:\Users\Acer_PC\Desktop\products.csv";
            ICsvManipulator      csvManipulator      = new CsvManipulator(path);
            IProductService      productService      = new ProductService(csvManipulator);
            IPointOfSaleTerminal pointOfSaleTerminal = new PointOfSaleTerminal(productService);

            pointOfSaleTerminal.SetPrice("A", 1.25, 3, 3.00);
            pointOfSaleTerminal.SetPrice("B", 4.25, 0, 0.00);
            pointOfSaleTerminal.SetPrice("C", 1.00, 6, 5.00);
            pointOfSaleTerminal.SetPrice("D", 0.75, 0, 0.00);

            //ABCDABA
            pointOfSaleTerminal.Set("A");
            pointOfSaleTerminal.Set("B");
            pointOfSaleTerminal.Set("C");
            pointOfSaleTerminal.Set("D");
            pointOfSaleTerminal.Set("A");
            pointOfSaleTerminal.Set("B");
            pointOfSaleTerminal.Set("A");
            var result = pointOfSaleTerminal.CalculateTotal();

            pointOfSaleTerminal.ResetBusket();
            System.Console.WriteLine(result);

            //CCCCCCC
            pointOfSaleTerminal.Set("C");
            pointOfSaleTerminal.Set("C");
            pointOfSaleTerminal.Set("C");
            pointOfSaleTerminal.Set("C");
            pointOfSaleTerminal.Set("C");
            pointOfSaleTerminal.Set("C");
            pointOfSaleTerminal.Set("C");
            result = pointOfSaleTerminal.CalculateTotal();
            pointOfSaleTerminal.ResetBusket();
            System.Console.WriteLine(result);

            //ABCD
            pointOfSaleTerminal.Set("A");
            pointOfSaleTerminal.Set("B");
            pointOfSaleTerminal.Set("C");
            pointOfSaleTerminal.Set("D");
            result = pointOfSaleTerminal.CalculateTotal();
            pointOfSaleTerminal.ResetBusket();
            System.Console.WriteLine(result);

            System.Console.ReadKey();
        }