Ejemplo n.º 1
0
        public void RunScanner()
        {
            var isRunning = true;

            while (isRunning)
            {
                ShowMenu();
                var userInput = Console.ReadLine();
                switch (userInput)
                {
                case "1":
                {
                    GenerateOutput(_scanService.Scan(CommonConstants.P1), CommonConstants.P1Pif, CommonConstants.P1St);
                }
                break;

                case "2":
                {
                    GenerateOutput(_scanService.Scan(CommonConstants.P2), CommonConstants.P2Pif, CommonConstants.P2St);
                }
                break;

                case "3":
                {
                    GenerateOutput(_scanService.Scan(CommonConstants.P3), CommonConstants.P3Pif, CommonConstants.P3St);
                }
                break;

                case "4":
                {
                    GenerateOutput(_scanService.Scan(CommonConstants.PERR), CommonConstants.PERRPif, CommonConstants.PERRSt);
                }
                break;

                case "5":
                {
                    Console.WriteLine("Byeee!");
                    isRunning = false;
                }
                break;

                default:
                {
                    Console.WriteLine("Invalid option!");
                }
                break;
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var setup   = new SetUpService();
            var catalog = setup.CreateCatalogue();

            var scanService  = new ScanService(catalog);
            var totalService = new TotalUpService(catalog);

            Console.WriteLine("Checkout service");
            Console.WriteLine("Please enter the code for each item and press enter. Entering 'DONE' will return the total");

            var checkOut = false;

            while (!checkOut)
            {
                var line = Console.ReadLine();
                if (line == "DONE")
                {
                    checkOut = true;
                    Console.WriteLine("Total: " + totalService.TotalUp(scanService.ScannedItems).ToString());
                    Console.ReadLine();
                }
                else
                {
                    try
                    {
                        scanService.Scan(line);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public void ScanDisc()
 {
     VerifyAccess();
     if (this.scanService.IsScanning)
     {
         scanService.Stop();
     }
     if (SourceDrive != null && SourceDrive.IsReady)
     {
         scanService.Scan(Path.Combine(SourceDrive.RootDirectory.FullName, "VIDEO_TS"), 0, 0);
     }
 }
Ejemplo n.º 4
0
        public void ScanService_return_list_of_items(string inputData)
        {
            //given
            var expected = typeof(IEnumerable <ScannedProducts>);

            ItemstoScan items = new ItemstoScan(inputData);
            var         sut   = new ScanService();

            //when
            var actual = sut.Scan(items);

            //then
            Assert.IsAssignableFrom(expected, actual);
        }
Ejemplo n.º 5
0
 public async Task StartScan()
 {
     await _scanService.Scan();
 }
 public void ScanCodeWhichDoesNotExist()
 {
     ScanService.Scan("XXX");
     Assert.AreEqual(ScanService.ScannedItems.Count(), 0);
 }