Beispiel #1
0
        public void AddDataRows_HappyPath()
        {
            var lease                    = "A";
            var dateReceived             = new DateTime(2000, 1, 1);
            var effectiveDate            = new DateTime(2001, 1, 1);
            var leasePakOperatorInitials = "F";
            var paymentType              = "G";
            var amount                   = 1000.00m;
            var amountReversed           = 2000.00m;
            var paymentDueDate           = new DateTime(2002, 1, 1);
            var invoiceNumber            = "K";

            var reportLine = $"{lease} B {dateReceived:MM/dd/yyyy} D {effectiveDate:MM/dd/yyyy} {leasePakOperatorInitials} {paymentType} {amount} {amountReversed} {paymentDueDate:MM/dd/yyyy} {invoiceNumber} L";
            var parsedText = new List <string>()
            {
                reportLine, reportLine, reportLine
            };

            var obj = new CashReceiptsReport(null, null, null);

            obj.SetColumnSplitIndices(new List <int>()
            {
                1, 3, 14, 16, 27, 29, 31, 39, 47, 58, 60
            });
            obj.AddDataRows(parsedText);

            var dataRows = obj.GetDataRows();

            Assert.IsTrue(dataRows.Any());
            Assert.AreEqual(parsedText.Count, dataRows.Count);
            Assert.IsTrue(dataRows.All(x => x != null));
        }
Beispiel #2
0
        public void AddDataRows_NullList()
        {
            var obj = new CashReceiptsReport(null, null, null);

            obj.AddDataRows(null);

            Assert.IsTrue(!obj.GetDataRows().Any());
        }
Beispiel #3
0
        public void AddDataRows_EmptyList()
        {
            var parsedText = new List <string>();

            var obj = new CashReceiptsReport(null, null, null);

            obj.AddDataRows(parsedText);

            Assert.IsTrue(!obj.GetDataRows().Any());
        }
Beispiel #4
0
        public void GetFileStream_FileDoesNotExist()
        {
            var mockFile = new Mock <IFileRepository>();

            mockFile.Setup(x => x.FileExists(It.IsAny <string>())).Returns(false);

            var mockCalendar = new Mock <ICalendarRepository>();

            mockCalendar.Setup(x => x.GetPreviousBusinessDay(It.IsAny <DateTime>())).Returns(DateTime.Today);

            var obj = new CashReceiptsReport(null, mockFile.Object, mockCalendar.Object);

            obj.SetPortfolio("A");
            obj.SetReportDate(DateTime.Today);

            obj.GetFileStream();

            Assert.Fail();
        }
Beispiel #5
0
        public void GetFilePath_HappyPath()
        {
            var mock = new Mock <ICalendarRepository>();

            mock.Setup(x => x.GetPreviousBusinessDay(It.IsAny <DateTime>())).Returns(DateTime.Today);

            var portfolio = "A";
            var obj       = new CashReceiptsReport(null, null, mock.Object);

            obj.SetPortfolio(portfolio);
            obj.SetReportDate(DateTime.Today);

            var filePath = obj.GetFilePath();

            // Have to get two business days ago
            mock.Verify(x => x.GetPreviousBusinessDay(DateTime.Today), Times.Exactly(2));

            Assert.AreEqual($@"{RuntimeSettings.LeasePakReporting.ReportingFolderFilepath}\{DateTime.Today:MMddyy}\p{portfolio}_{Constants.LeasePakReporting.CashReceiptsReportFileName}", filePath);
        }
Beispiel #6
0
        public void GetFileStream_HappyPath()
        {
            var mockFile = new Mock <IFileRepository>();

            mockFile.Setup(x => x.FileExists(It.IsAny <string>())).Returns(true);

            var mockCalendar = new Mock <ICalendarRepository>();

            mockCalendar.Setup(x => x.GetPreviousBusinessDay(It.IsAny <DateTime>())).Returns(DateTime.Today);

            var obj = new CashReceiptsReport(null, mockFile.Object, mockCalendar.Object);

            obj.SetPortfolio("A");
            obj.SetReportDate(DateTime.Today);

            var fileStream = obj.GetFileStream();

            mockFile.Verify(x => x.FileExists(obj.GetFilePath()));
            Assert.IsTrue(true);
        }