Exemplo n.º 1
0
        static void Main(string[] args)
        {
            VendingMachine    VM  = new VendingMachine("VendingMachine.txt");
            VendingMachineCLI CLI = new VendingMachineCLI(VM);

            CLI.Run();
        }
        static void Main(string[] args)
        {
            // Instantiate the dependencies
            IInventorySource   inventorySource   = new InventoryFileDAL("vendingmachine.csv");
            ITransactionLogger transactionLogger = new TransactionFileLog("transactions.txt");

            // IInventorySource inventorySource = new InventorySqlDAL("connectionstring");

            VendingMachine vm;

            try
            {
                // Inject the dependency into the class using the constructor
                vm = new VendingMachine(inventorySource, transactionLogger);
            }
            catch
            {
                Console.WriteLine();
                Console.WriteLine("An error occurred starting the vending machine. The program is going to exit.");
                return;
            }

            // Start the CLI and run the menu
            VendingMachineCLI cli = new VendingMachineCLI(vm);

            cli.Run();
        }
        static void Main(string[] args)
        {
            VendingMachine    vm  = new VendingMachine();
            VendingMachineCLI cli = new VendingMachineCLI(vm);

            cli.Run();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            VendingMachine    vm    = new VendingMachine();
            VendingMachineCLI vmcli = new VendingMachineCLI(vm);

            vmcli.Run();
            Environment.Exit(0);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            VendingMachineFileReader reader = new VendingMachineFileReader("vendingmachine.csv");
            var inventory = reader.GetInventory();

            VendingMachine vm = new VendingMachine(inventory);

            VendingMachineCLI cli = new VendingMachineCLI(vm);

            cli.Run();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            const string localConnectionString = "Data Source=localhost\\sqlexpress;Initial Catalog=VendingMachine;Integrated Security=True";

            // Instantiate the dependencies

            IInventorySource   inventorySource;
            ITransactionLogger transactionLogger;

            string mode = Properties.Settings.Default.DataSource;

            if (mode == "file")
            {
                inventorySource   = new InventoryFileDAL("vendingmachine.csv");
                transactionLogger = new TransactionFileLog("transactions.txt");
            }
            else
            {
                inventorySource   = new InventorySqlDAL(localConnectionString);
                transactionLogger = new TransactionFileSqlLog(localConnectionString);
            }

            VendingMachine vm;

            try
            {
                // Inject the dependency into the class using the constructor
                vm = new VendingMachine(inventorySource, transactionLogger);
            }
            catch
            {
                Console.WriteLine();
                Console.WriteLine("An error occurred starting the vending machine. The program is going to exit.");
                return;
            }

            // Start the CLI and run the menu
            VendingMachineCLI cli = new VendingMachineCLI(vm);

            cli.Run();
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            VendingMachineCLI test = new VendingMachineCLI();

            test.Run();
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            VendingMachineCLI cli = new VendingMachineCLI("vendingmachine.csv");

            cli.Run();
        }