Exemplo n.º 1
0
        public void Should_ParseLine_When_CurrencyIsNotGryvna()
        {
            var analyzer = new AvalAnalizer();

            var report = analyzer.ParseReportLine(LineWithDollarLikeACurrency);

            Assert.AreEqual(-28.25, report.Amount);
        }
Exemplo n.º 2
0
        public void Should_ParseFullLineOfAvalReport()
        {
            var analyzer = new AvalAnalizer();

            var report = analyzer.ParseReportLine(SimpleLine);

            Assert.AreEqual(new DateTime(2018, 11, 4), report.Date);
            Assert.AreEqual("205 - Безготівковий платіж.dofiokofekafe KIYEV", report.Details);
            Assert.AreEqual(-148.00, report.Amount);
        }
Exemplo n.º 3
0
        public void Should_ParseWholeDocument()
        {
            var analyzer = new AvalAnalizer();
            var report   = File.ReadAllLines(@"Resources\070818-061118.csv");
            var parsed   = new List <IPayment>();

            //TODO put to another tests
            var canParseReport = AvalAnalizer.CanParse(report[0]);

            Assert.IsTrue(canParseReport);

            for (int i = 1; i < report.Length; i++)
            {
                //TODO change to parsing result. With exception. Generic implementation is possible
                parsed.Add(analyzer.ParseReportLine(report[i]));
            }

            Assert.AreEqual(report.Length - 1, parsed.Count);
        }
Exemplo n.º 4
0
        public void Should_ParseWholeDocument()
        {
            var analyzer = new AvalAnalizer();

            string[] report = ReadReportFromResource();
            var      parsed = new List <IPayment>();

            for (int i = 1; i < report.Length; i++)
            {
                try
                {
                    var item = analyzer.ParseReportLine(report[i]);
                    parsed.Add(item);
                }
                catch (Exception ex)
                {
                    Assert.Fail("Cannot parse line:{0}; Exception: {1}", report[i], ex);
                }
            }

            Assert.AreEqual(report.Length - 1, parsed.Count);
        }
Exemplo n.º 5
0
        public void Should_ParseLine_When_ItIsIncomming()
        {
            var analyzer = new AvalAnalizer();

            analyzer.ParseReportLine(IncommingBill);
        }
Exemplo n.º 6
0
        public void Should_ParseLine_When_SomeFieldsAbsent()
        {
            var analyzer = new AvalAnalizer();

            analyzer.ParseReportLine(LineWithEmptyData);
        }