예제 #1
0
        private void Execute()
        {
            ICashRegisterInputMgr inputMgr = new CashRegisterInputMgrFactory(MoneyConstants.Infile).GetCashRegisterInputMgr();
            List<TransactionAmounts> list = inputMgr.HandleInput("C:/Dev/CashRegister/input/crt-test-data.csv");

            List<string> strList = new CashRegisterManager().ProcessAmountsFromList(list);

            ICashRegisterOutputMgr outputMgr = new CashRegisterOutputMgrFactory(MoneyConstants.Outfile).GetCashRegisterOutputMgr();
            bool status = outputMgr.HandleOutput("C:/Dev/CashRegister/input/output.csv", strList);
               // Console.ReadLine();
        }
예제 #2
0
        public void TestCashRegisterManagerWriteOutput()
        {
            string outFile = "C:/Dev/CashRegister/input/output.csv";
            ICashRegisterOutputMgr outMgr = new CashRegisterOutputMgrFactory(MoneyConstants.Outfile).GetCashRegisterOutputMgr();
            List<string> strList = new List<string>();
            strList.Add("Test1");
            strList.Add("Test2");
            strList.Add("Test3");
            try
            {
                outMgr.HandleOutput(outFile, strList);
            }
            catch (Exception e)
            {
                Assert.Fail();
            }
            // the actual test...
            int count = 0;
            using (var rd = new StreamReader(outFile))
            {
                while (!rd.EndOfStream)
                {
                    rd.ReadLine();
                    count++;
                }
            }

            Assert.AreEqual(count, 3);
        }