示例#1
0
        public static void Run(Options options)
        {
            if (!File.Exists(options.PathToCsv))
            {
                System.Console.WriteLine($"File at {options.PathToCsv} does not exist.");
                Environment.Exit(1);
            }

            ConsoleKey choice;
            var        transactions = TransactionLoader.LoadTransactions(options.PathToCsv);

            PrintTitle();

            do
            {
                PrintMenu();
                choice = GetInput();
                RunBusinessLogic(choice, transactions);
            }while (choice != ConsoleKey.D0);
        }
        public void LoadCsvWithTooFewColumnsTest()
        {
            Action loadBadCsv = () => TransactionLoader.LoadTransactions(CsvWithTooFewColumns);

            loadBadCsv.Should().Throw <BadDataException>();
        }
        public void LoadValidCsvTest()
        {
            var transactions = TransactionLoader.LoadTransactions(KnownGoodCsv);

            transactions.Should().HaveCount(12);
        }