예제 #1
0
        static void Main(string[] args)
        {
            var t0 = DateTime.Now;
            var testExchangeData = new List <ExchangeRate>()
            {
                new ExchangeRate(Currency.USD, Currency.MXN, 1.5),
                new ExchangeRate(Currency.USD, Currency.EUD, 2.5),
                new ExchangeRate(Currency.USD, Currency.THB, 3.5),
                new ExchangeRate(Currency.USD, Currency.GBP, 4.5),


                new ExchangeRate(Currency.MXN, Currency.EUD, 2.5),
                new ExchangeRate(Currency.MXN, Currency.THB, 3.5),
                new ExchangeRate(Currency.MXN, Currency.GBP, 4.5),

                new ExchangeRate(Currency.EUD, Currency.THB, 3.5),
                new ExchangeRate(Currency.EUD, Currency.GBP, 4.5),

                new ExchangeRate(Currency.THB, Currency.GBP, 4.5)
            };

            var converter = new CurrencyConverter(testExchangeData);

            var reader = new FileReader();

            var accounts = new AccountParser().ParseFile(reader.ReadFile("./accounts-1m.txt"));

            Console.WriteLine("AccountParser complete");
            var transactions = new TransactionParser().ParseFile(reader.ReadFile("./transactions-1m.txt"));

            Console.WriteLine("AccountParser complete");

            var processor = new Processor(converter, accounts, transactions);

            Console.WriteLine("AccountParser complete");

            processor.Process();

            foreach (var account in accounts)
            {
                Console.WriteLine(account);
            }
            var t8 = DateTime.Now;

            Console.WriteLine("AccountParser complete");
            Console.WriteLine("Complete " + (t8 - t0).ToString());
        }
예제 #2
0
        static void Main(string[] args)
        {
            var testExchangeData = new List <ExchangeRate>()
            {
                new ExchangeRate(Currency.USD, Currency.MXN, 1.5),
                new ExchangeRate(Currency.USD, Currency.EUD, 2.5),
                new ExchangeRate(Currency.USD, Currency.THB, 3.5),
                new ExchangeRate(Currency.USD, Currency.GBP, 4.5),


                new ExchangeRate(Currency.MXN, Currency.EUD, 2.5),
                new ExchangeRate(Currency.MXN, Currency.THB, 3.5),
                new ExchangeRate(Currency.MXN, Currency.GBP, 4.5),

                new ExchangeRate(Currency.EUD, Currency.THB, 3.5),
                new ExchangeRate(Currency.EUD, Currency.GBP, 4.5),

                new ExchangeRate(Currency.THB, Currency.GBP, 4.5)
            };

            var converter = new CurrencyConverter(testExchangeData);

            var reader = new FileReader();

            var accounts     = new AccountParser().ParseFile(reader.ReadFile("../accounts1.2m.txt"));
            var transactions = new TransactionParser().ParseFile(reader.ReadFile("../transactions10m.txt"));

            var processor = new Processor(converter, accounts, transactions);

            processor.Process();

            using (var file = new StreamWriter("output.txt"))
            {
                foreach (var account in accounts)
                {
                    file.WriteLine(account.Value);
                }
            }

            Console.WriteLine("Done");
        }