public OFXData LoadData(OFXReader OFXReader)
        {
            OFXData          data      = new OFXData();
            OFXBankStatement statement = null;
            var statements             = new List <OFXBankStatement>();
            var fs = OFXReader.GetFileData();

            using (var reader = new StreamReader(fs, System.Text.Encoding.UTF8))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    data      = ReturnAll(line, "<OFX>", data);
                    data      = ReturnAll(line, "<CODE>", data);
                    data      = ReturnAll(line, "<SEVERITY>", data);
                    data      = ReturnAll(line, "<DTSERVER>", data);
                    data      = ReturnAll(line, "<LANGUAGE>", data);
                    data      = ReturnAll(line, "<TRNUID>", data);
                    data      = ReturnAll(line, "<CURDEF>", data);
                    data      = ReturnAll(line, "<BANKID>", data);
                    data      = ReturnAll(line, "<ACCTID>", data);
                    data      = ReturnAll(line, "<ACCTTYPE>", data);
                    data      = ReturnAll(line, "<BALAMT>", data);
                    data      = ReturnAll(line, "<DTASOF>", data);
                    statement = ReturnAll(line, "<TRNTYPE>", statement, statements);
                    statement = ReturnAll(line, "<DTPOSTED>", statement, statements);
                    statement = ReturnAll(line, "<TRNAMT>", statement, statements);
                    statement = ReturnAll(line, "<MEMO>", statement, statements);
                }
                data.statements = statements;
            }

            return(data);
        }
        private OFXData ReturnAll(string line, string tagName, OFXData _OFXData)
        {
            if (line.IndexOf(tagName) >= 0)
            {
                if (_OFXData == null)
                {
                    _OFXData = new OFXData();
                }

                _OFXData.SetTag(tagName, ReturnValue(line, tagName));
            }
            return(_OFXData);
        }
        public void LoaOFCFile()
        {
            OFXDataBusiness business = new OFXDataBusiness();


            var data     = new OFXData();
            var fileName = @"OFXFIles\extrato1.ofx";

            OFXReader r = new OFXReader(fileName);



            var _OFXData = business.LoadData(r);

            Assert.IsTrue(((List <OFXBankStatement>)_OFXData.statements).Count() == 31);
        }