Example #1
0
        static void Main(string[] args)
        {
            Trace.Listeners.Add(new ConsoleTraceListener());

            //var currencyConverter = new LazyCurrencyConverter();
            var currencyConverter     = new ExchangeRatesApiConverter(new HttpClient(), new MemoryCache(new MemoryCacheOptions()), "950ad6c9199ec17f1dab4f8a93c1739b");
            var transactionRepository = new InMemoryTransactionRepository();
            var transactionParser     = new TransactionParser();
            var comissionCalculator   = new ComissionCalculator();

            var budgetApp = new BudgetApplication(transactionRepository, transactionParser, currencyConverter, comissionCalculator);

            // 1. Predefined constant transactions input
            var transactionsInputPredefined = new TransactionsInputPredefined(budgetApp);

            transactionsInputPredefined.ReadTransactions();

            // 2. Loading from file
            //var transactionsInputLoadingFromFile = new TransactionsInputLoadingFromFile(budgetApp);
            //transactionsInputLoadingFromFile.ReadTransactions("file.txt");

            // 3. Console user input
            //var transactionsInputFromUserConsole = new TransactionsInputFromUserConsole(budgetApp);
            //transactionsInputFromUserConsole.ReadTransactions();

            budgetApp.OutputTransactions();
            budgetApp.OutputBalanceInCurrency("USD");

            Console.Read();
        }
Example #2
0
        static async Task Main(string[] args)
        {
            Trace.Listeners.Add(new ConsoleTraceListener());

            var currencyConverter = new ExchangeRatesApiConverter(new HttpClient(), new MemoryCache(new MemoryCacheOptions()), "a5cf9da55cb835d0a633a7825b3aa8b5");

            var transactionRepository = new InMemoryTransactionRepository();
            var transactionParser     = new TransactionParser();

            var budgetApp = new BudjetApplication(transactionRepository, transactionParser, currencyConverter);

            budgetApp.AddTransaction("Трата -400 RUB Продукты Пятерочка");
            budgetApp.AddTransaction("Трата -2000 RUB Бензин IRBIS");
            budgetApp.AddTransaction("Трата -500 RUB Кафе Шоколадница");

            budgetApp.OutputTransactions();

            budgetApp.OutputBalanceInCurrency("USD");

            Console.Read();
        }
Example #3
0
        static async Task Main(string[] args)
        {
            Trace.Listeners.Add(new ConsoleTraceListener());

            var currencyConverter     = new ExchangeRatesApiConverter(new HttpClient(), new MemoryCache(new MemoryCacheOptions()), "a5cf9da55cb835d0a633a7825b3aa8b5");
            var transactionRepository = new InMemoryTransactionRepository();
            var transactionParser     = new TransactionParser();
            var budgetApp             = new BudjetApplication(transactionRepository, transactionParser, currencyConverter);

            budgetApp.AddTransaction("Зачисление 10000 RUB SberBank");
            budgetApp.AddTransaction("Трата -400 RUB Продукты Пятерочка");
            budgetApp.AddTransaction("Трата -5 RUB Разное И пакетик пожалуйста");
            budgetApp.AddTransaction("Трата -2000 RUB Бензин IRBIS");
            budgetApp.AddTransaction("Трата -500 RUB Кафе Шоколадница");
            budgetApp.AddTransaction("Перевод 2000 RUB SergeyP Долг");
            budgetApp.AddTransactionsFromFile(@"D:\Workspace\Projects\OTUS.BudgetApplication\otus-interfaces\Files\some-transactions.txt");
            budgetApp.ReadTransactionFromConsole();

            budgetApp.OutputTransactions();

            await budgetApp.OutputBalanceInCurrency("USD");

            Console.Read();
        }