Пример #1
0
        public void AlphaPaymentReader_WhenGivenGarbage_ThrowsBadFileFormatException()
        {
            var provider = new FakePaymentRecordProvider("this is not a valid file");
            var reader = new AlphaPaymentReader(provider);

            reader.ProcessAllRecords();
        }
Пример #2
0
        public void AlphaPaymentReader_WhenGivenExampleFile_CreatesAValidBundle()
        {
            using (var provider = new FileRawPaymentRecordProvider(@"Examplefiles\example_alphapayment.txt"))
            {
                var reader = new AlphaPaymentReader(provider);

                var result = reader.ProcessAllRecords();

                Assert.AreEqual(1, result.Count, "nr of payment bundles");
                Assert.AreEqual(4, result.First().Payments.Count, "nr of payments");
            }
        }
Пример #3
0
        private IPaymentReader GetReader(FileRawPaymentRecordProvider provider)
        {
            IPaymentReader reader;
            var filename = provider.PaymentFilePath;
            if (filename.EndsWith("_alphapayment.txt"))
            {
                reader = new AlphaPaymentReader(provider);
            }
            else if (filename.EndsWith("_betapayment.txt"))
            {
                reader = new BetaPaymentReader(provider, DateTime.Today);
            }
            else
            {
                throw new ApplicationException($"Unable to determine type for payment file: {filename}");
            }

            return reader;
        }