public TransactionController(IMapper mapper, ITransactionReader transactionReader,
                              ITransactionImporter transactionImporter, IFileParser fileParser)
 {
     _mapper              = mapper;
     _fileParser          = fileParser;
     _transactionReader   = transactionReader;
     _transactionImporter = transactionImporter;
 }
        public TransactionReaderTests()
        {
            _transactionParserMock = new Mock <ITransactionParser>();

            var transaction = new Transaction
            {
                Size             = Constants.Sizes.Medium,
                Date             = DateTime.UtcNow,
                ShippingPrice    = Constants.ShippingPrices.Medium.LaPoste,
                ShippingProvider = Constants.Providers.LaPoste,
                Discount         = new decimal(0.5)
            };

            _transactionParserMock.Setup(p => p.ParseTransaction(It.IsAny <string>()))
            .Returns(transaction);

            _transactionReader = new TransactionReader(_transactionParserMock.Object);
        }
Exemple #3
0
        private static IEnumerable <Transaction> LoadTransactions(string path)
        {
            var fileName = Path.GetFileName(path);

            var result                = new List <Transaction>();
            var reverseResult         = false;
            ITransactionReader reader = null;

            try
            {
                if (fileName.StartsWith("CSV_O_"))
                {
                    Console.WriteLine("Detected Rabobank file.");
                    reader = new RabobankTransactionReader(File.OpenText(path));
                }
                else
                {
                    Console.WriteLine("Detected ING file.");
                    reader        = new INGTransactionReader(File.OpenText(path));
                    reverseResult = true;
                }

                Transaction transaction;
                while ((transaction = reader.ReadTransaction()) != null)
                {
                    result.Add(transaction);
                }
            }
            finally
            {
                reader?.Dispose();
            }

            if (reverseResult)
            {
                result.Reverse();
            }

            return(result);
        }
Exemple #4
0
 public TransactionsController(ITransactionReader transactionReader)
 {
     _transactionReader = transactionReader;
 }
 public ColumnFinder(ITransactionReader transactionReader)
 {
     this.transactionReader = transactionReader;
 }
 public void SetTransactionReader(ITransactionReader reader) => _reader = reader;
 public NonInvestmentTransactionRepository(ITransactionReader reader)
 {
     _reader = reader;
 }
Exemple #8
0
 public TransactionSelector(ITransactionReader transactionReader, ITransactionFeeWriter transactionFeeWriter, ITransactionCharger transactionCharger)
 {
     _transactionReader    = transactionReader;
     _transactionFeeWriter = transactionFeeWriter;
     _transactionCharger   = transactionCharger;
 }
Exemple #9
0
 public TransactionReaderTests()
 {
     _fileReaderMock           = new Mock <IFileReader>(MockBehavior.Strict);
     _transactionFormatterMock = new Mock <ITransactionFormatter>(MockBehavior.Strict);
     _sut = new TransactionReader(_fileReaderMock.Object, _transactionFormatterMock.Object);
 }