示例#1
0
        private void ProcessFiles()
        {
            _processing = true;
            string    fileName;
            IFacility facility;

            log.Info("ProcessFiles called with " + _filesToProcess.Count + " in queue.");

            while (_filesToProcess.Count > 0)
            {
                fileName = _filesToProcess.Dequeue();
                log.Info("File: " + fileName + " is being processed.");
                FacilityFactory.Log = log;
                try
                {
                    facility = FacilityFactory.ProcessFile(fileName);
                    log.Info(fileName + " had " + facility.Checks + " checks.");

                    if (ConfigurationManager.AppSettings["AppMode"].ToUpper().Equals("PRODUCTION"))
                    {
                        NotifyPositivePay(facility);
                    }
                }
                catch (KeyNotFoundException ex)
                {
                    log.Error("Facility that created [" + fileName + "] is not matched to a Bank Number.");
                }
                catch (Exception ex)
                {
                    log.Error(ex.Message);
                }
            }
            _processing = false;
        }
示例#2
0
        public void ParseOldFileNameTest()
        {
            string fullFileName = string.Empty, bankName = string.Empty, acctNo = string.Empty, facName = string.Empty;

            fullFileName = "Facname_bank-456789_14-Nov-2018_1234.csv";
            FacilityFactory.ParseFileName(fullFileName, ref bankName, ref acctNo, ref facName);
            Assert.AreEqual("bank", bankName);
            Assert.AreEqual("456789", acctNo);
            Assert.AreEqual("Facname", facName);
        }
示例#3
0
        public void ProcessFileTest()
        {
            IFacility Facility;

            FacilityFactory.Log = LogManager.GetLogger("TestingLog");

            string inputFile      = TestContext.DataRow["inputFileName"].ToString();
            string outputFileName = TestContext.DataRow["outputFileName"].ToString();

            Facility = FacilityFactory.ProcessFile(inputFile);
            string actualOutputFile = Facility.OutputFileName;

            FileAssert.AreEqual(outputFileName, actualOutputFile);
        }