Пример #1
0
        public void PopulateDatabase()
        {
            //IVendingService db = new VendingDBService();
            IVendingService db = new MockVendingDBService();

            TestManager.PopulateDatabaseWithInventory(db);
            TestManager.PopulateDatabaseWithTransactions(db);
        }
Пример #2
0
        static void Main(string[] args)
        {
            //IVendingService db = new VendingDBService();
            IVendingService db = new MockVendingDBService();

            var items = db.GetVendingItems();

            InventoryManager inventory = new InventoryManager(items);

            for (int rowIdx = 1; rowIdx <= inventory.RowCount; rowIdx++)
            {
                for (int colIdx = 1; colIdx <= inventory.ColCount; colIdx++)
                {
                    Console.WriteLine(inventory.GetVendingItem(rowIdx, colIdx).ToString());
                }
            }

            Console.WriteLine();
            Console.WriteLine();

            ReportManager reportManager = new ReportManager(db);
            Report        report        = reportManager.GetReport(2018, db.GetProductItems());
            var           reportItems   = report.ReportItems;

            foreach (var item in reportItems)
            {
                Console.WriteLine($"{item.Name}|{item.Qty}");
            }
            Console.WriteLine();
            Console.WriteLine($"**Total Sales** {report.TotalSales.ToString("c")}");

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();

            ILogService log    = new LogFileService();
            Change      change = TestManager.PopulateLogFileWithOperations(db, log);

            Console.WriteLine(log.GetLogData());

            Console.WriteLine();
            Console.WriteLine();

            TransactionManager trans = new TransactionManager(db, log);

            Console.WriteLine($"Change: {change.Dollars} Dollars {change.Quarters} Quarters {change.Dimes} Dimes {change.Nickels} Nickels {change.Pennies} Pennies");

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
            IConfigurationRoot configuration = builder.Build();

            string connectionString = configuration.GetConnectionString("DefaultConnection");

            //var db = new VendingDBService(connectionString);
            var db = new MockVendingDBService();

            //var log = new LogFileService();
            var            log = new LogDBService(connectionString);
            VendingMachine vm  = new VendingMachine(db, log);
            VndrCLI        cli = new VndrCLI(vm);

            cli.Run();
        }