public void ShouldReadAmoutCorrectly()
        {
            var parser = new OFXParser();
            var amount = parser.Parse(GetDummyDataFile()).First().Amount;

            Assert.True(amount != 0);
        }
        public void ShouldReadOnlyTheNodeContent()
        {
            var parser      = new OFXParser();
            var transaction = parser.Parse(GetDummyDataFile()).First();

            Assert.True(transaction.Description.IndexOf("<MEMO>") < 0);
        }
        public void ShouldConvertToList()
        {
            var parser = new OFXParser();
            var list   = parser.Parse(GetDummyDataFile());

            Assert.True(list is List <BankTransaction>);
        }
        public void ShouldReadDateTimeCorrectly()
        {
            var parser        = new OFXParser();
            var wrongDateTime = new DateTime(1, 1, 1, 0, 0, 0);
            var dateTime      = parser.Parse(GetDummyDataFile()).First().Date;

            Assert.False(dateTime == wrongDateTime);
        }
Пример #5
0
        /// <summary>
        /// Parse and map extracts to reconciliate
        /// </summary>
        /// <param name="files"></param>
        /// <returns></returns>
        public async Task <BankConsolidateExtractDTO> ParseAndConsolidateExtractsAsync(IList <IFormFile> files)
        {
            List <Extract> extracts = new List <Extract>();

            // Parse each ofx file and map it to domain
            foreach (var file in files)
            {
                var parsedExtract = await OFXParser.Parse(file);

                var extract = parsedExtract.ToDomain();

                extracts.Add(extract);
            }

            // Reconciliate extracts
            BankConsolidateExtract result = this.bankOperationsDomainService.ConsolidateExtracts(extracts);

            // Map result to DTO
            var response = result.ToDTO();

            return(response);
        }