Пример #1
0
        public void BatchHeader_TestRowCreation()
        {
            var _suts = new List <BatchHeader>();
            var _suti = new BatchHeader
            {
                ServiceClassCode         = BatchServiceClassCodeConstant.Credits,
                CompanyName              = "CONTRACTOR MGMT",
                CompanyDiscretionaryData = "",
                CompanyIdentification    = "9876543210",
                StandardEntryClassCode   = StandardEntryClassCodeConstant.PPD,
                CompanyEntryDescription  = "SETTLEMENT",
                CompanyDescriptiveDate   = "",
                EffectiveEntryDate       = new DateTime(2016, 8, 11),
                OriginatorStatusCode     = BatchHeaderOriginatorStatusCodeConstant.NonFederalGovernment,
                OriginatingDfi           = "99889988"
            };

            _suts.Add(_suti);

            var _engine   = new FileHelpers.FileHelperEngine <BatchHeader>();
            var _test     = _engine.WriteString(_suts);
            var _expected = "5220CONTRACTOR MGMT                     9876543210PPDSETTLEMENT      160811   1998899880000000\r\n";

            Assert.Equal(_expected, _test);
        }
Пример #2
0
        public string WriteReport(string Header, ArrayList l)
        {
            try
            {
                if (l == null)
                {
                    return(string.Empty);
                }

                if (l.Count == 0)
                {
                    return(string.Empty);
                }

                FileHelpers.FileHelperEngine engine = new FileHelpers.FileHelperEngine(l[0].GetType());
                engine.HeaderText = Header;
                return(engine.WriteString(l));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
                throw ex;
            }
        }
        static void Main(string[] args)
        {
            rec record = new rec { id = 1, mydecimal = null };
             List<rec> records = new List<rec> { record };

             FileHelpers.FileHelperEngine<rec> engine = new FileHelpers.FileHelperEngine<rec>();

             Console.WriteLine(engine.WriteString(records));
        }
Пример #4
0
        public void FileControl_TestRowCreation()
        {
            var _suts = new List <FileControl>();
            var _sut  = new FileControl();

            _suts.Add(_sut);

            var _engine   = new FileHelpers.FileHelperEngine <FileControl>();
            var _test     = _engine.WriteString(_suts);
            var _expected = "9000000000000000000000000000000000000000000000000000000                                       \r\n";

            Assert.Equal(_expected, _test);
        }
Пример #5
0
        public void BatchControl_TestRowCreation()
        {
            var _suts = new List <BatchControl>();
            var _suti = new BatchControl
            {
                CompanyIdentification = "9876543210",
                OriginatingDfi        = "99889988",
                TotalCreditAmount     = 9223372036854775807,
                TotalDebitAmount      = 9223372036854775807
            };

            _suts.Add(_suti);

            var _engine   = new FileHelpers.FileHelperEngine <BatchControl>();
            var _test     = _engine.WriteString(_suts);
            var _expected = "820000000000000000009223372036859223372036859876543210                         998899880000000\r\n";

            Assert.Equal(_expected, _test);
        }
Пример #6
0
        public void FileHeader_TestRowCreation()
        {
            var _suts = new List <FileHeader>();
            var _suti = new FileHeader
            {
                ImmediateOriginName      = "Test Company Name",
                ImmediateDestinationName = "Bank of America DAL",
                CreationDate             = DateTime.Now,
                CreationTime             = DateTime.Now,
                Id = "A",
                ImmediateDestination = " 123456789",
                ImmediateOrigin      = "9996663331",
                ReferenceCode        = "ref#"
            };

            _suts.Add(_suti);

            var _engine    = new FileHelpers.FileHelperEngine <FileHeader>();
            var _test      = _engine.WriteString(_suts);
            var _timestamp = _suti.CreationDate.ToString("yyMMdd") + _suti.CreationTime.ToString("HHmm");
            var _expected  = "101 1234567899996663331" + _timestamp + "A094101Bank of America DAL    Test Company Name      ref#    \r\n";

            Assert.Equal(_expected, _test);
        }
Пример #7
0
        public void Entry_TestRowCreation()
        {
            var _suts = new List <Entry>();
            var _suti = new Entry(StandardEntryClassCodeConstant.CCD)
            {
                Amount = 99988,
                AddendaRecordIndicator       = (short)AddendaRecordIndicatorEnum.NotIncluded,
                CheckDigit                   = "8",
                RdfiAccountNumber            = "44556677",
                DiscretionaryData            = "",
                ReceiverIdentificationNumber = "ID#Something",
                RdfiRtn         = "99887766",
                ReceiverName    = "Receiving Company Name",
                TransactionCode = (short)TransactionCodeEnum.AutomatedDepositChecking
            };

            _suts.Add(_suti);

            var _engine   = new FileHelpers.FileHelperEngine <Entry>();
            var _test     = _engine.WriteString(_suts);
            var _expected = "62299887766244556677              99988ID#Something   Receiving Company Name  0               \r\n";

            Assert.Equal(_expected, _test);
        }
Пример #8
0
        public void File_TestHarness()
        {
            var _output = new StringBuilder();

            var _file = new File();

            _file.Header.Id = "A";
            _file.Header.ImmediateDestination     = " 091000019";
            _file.Header.ImmediateDestinationName = "WELLS FARGO";
            _file.Header.ImmediateOrigin          = "9876543210";
            _file.Header.ImmediateOriginName      = "Contractor Mgmt Srvcs";
            _file.Header.ReferenceCode            = "";

            _file.AddBatch(new Batch());

            _file.Batches[0].Header.CompanyName             = "Contractor Mgmt";
            _file.Batches[0].Header.CompanyIdentification   = "9876543210";
            _file.Batches[0].Header.StandardEntryClassCode  = StandardEntryClassCodeConstant.CCD;
            _file.Batches[0].Header.CompanyEntryDescription = "SETTLEMENT";
            _file.Batches[0].Header.EffectiveEntryDate      = DateTime.Now;
            _file.Batches[0].Header.OriginatingDfi          = "09100001";

            _file.Batches[0].AddEntry(new Entry(StandardEntryClassCodeConstant.CCD)
            {
                Amount = 99988,
                AddendaRecordIndicator       = (short)AddendaRecordIndicatorEnum.NotIncluded,
                CheckDigit                   = "8",
                RdfiAccountNumber            = "44556677",
                DiscretionaryData            = "",
                ReceiverIdentificationNumber = "ID#Something1",
                RdfiRtn         = "99887766",
                ReceiverName    = "Receiving Company Name1",
                TransactionCode = (short)TransactionCodeEnum.AutomatedDepositChecking
            });

            _file.Batches[0].AddEntry(new Entry(StandardEntryClassCodeConstant.CCD)
            {
                Amount = 1250233,
                AddendaRecordIndicator       = (short)AddendaRecordIndicatorEnum.NotIncluded,
                CheckDigit                   = "8",
                RdfiAccountNumber            = "11223344",
                DiscretionaryData            = "",
                ReceiverIdentificationNumber = "ID#Something2",
                RdfiRtn         = "99887766",
                ReceiverName    = "Receiving Company Name2",
                TransactionCode = (short)TransactionCodeEnum.AutomatedDepositSavings
            });

            var _fileHeaders = new List <FileHeader>();

            _fileHeaders.Add(_file.Header);
            var _engine = new FileHelpers.FileHelperEngine <FileHeader>();

            _output.Append(_engine.WriteString(_fileHeaders));

            foreach (var batch in _file.Batches)
            {
                var _batchHeaders = new List <BatchHeader>();
                _batchHeaders.Add(batch.Header);
                var _batchEngine = new FileHelpers.FileHelperEngine <BatchHeader>();
                _output.Append(_batchEngine.WriteString(_batchHeaders));

                var _entries = new List <Entry>();
                foreach (var entry in batch.Entries)
                {
                    _entries.Add(entry);
                }

                var _entryEngine = new FileHelpers.FileHelperEngine <Entry>();
                _output.Append(_entryEngine.WriteString(_entries));

                var _batchControls = new List <BatchControl>();
                _batchControls.Add(batch.Control);
                var _batchControlEngine = new FileHelpers.FileHelperEngine <BatchControl>();
                _output.Append(_batchControlEngine.WriteString(_batchControls));
            }

            var _fileControls = new List <FileControl>();

            _fileControls.Add(_file.Control);
            var _fileControlEngine = new FileHelpers.FileHelperEngine <FileControl>();

            _output.Append(_fileControlEngine.WriteString(_fileControls));
            // do we want our own "checksum"

            System.IO.File.WriteAllText(@"C:\NachaTest.txt", _output.ToString());
        }