Exemple #1
0
        public void Will_populate_zero_amounts_as_empty_cred_card2_in_out_record_cells()
        {
            // Arrange
            var cred_card2_in_out_record = new CredCard2InOutRecord
            {
                Unreconciled_amount = 0,
                Reconciled_amount   = 0
            };
            var cells           = _spreadsheet.Current_cells("CredCard");
            var last_row_number = _spreadsheet.Last_row_number("CredCard");
            var previous_record = new CredCard2InOutRecord();

            previous_record.Read_from_spreadsheet_row(_spreadsheet.Read_last_row("CredCard"));

            // Act
            cred_card2_in_out_record.Populate_spreadsheet_row(cells, last_row_number);
            var new_row = _spreadsheet.Read_last_row("CredCard");

            // Assert
            Assert.AreEqual(null, new_row.Read_cell(1));
            Assert.AreEqual(null, new_row.Read_cell(4));

            // Clean up
            previous_record.Populate_spreadsheet_row(cells, last_row_number);
        }
Exemple #2
0
        public void Will_populate_cred_card2_in_out_record_cells()
        {
            // Arrange
            var cred_card2_in_out_record = new CredCard2InOutRecord
            {
                Date = new DateTime(year: 2017, month: 4, day: 1),
                Unreconciled_amount = 22.48,
                Description         = "New description which will overwrite what's normally there.",
                Reconciled_amount   = 661234.56
            };
            var cells           = _spreadsheet.Current_cells("CredCard");
            var last_row_number = _spreadsheet.Last_row_number("CredCard");
            var previous_record = new CredCard2InOutRecord();

            previous_record.Read_from_spreadsheet_row(_spreadsheet.Read_last_row("CredCard"));

            // Act
            cred_card2_in_out_record.Populate_spreadsheet_row(cells, last_row_number);
            var new_row = _spreadsheet.Read_last_row("CredCard");

            // Assert
            Assert.AreEqual(cred_card2_in_out_record.Date, DateTime.FromOADate((double)new_row.Read_cell(0)));
            Assert.AreEqual(cred_card2_in_out_record.Unreconciled_amount, (Double)new_row.Read_cell(1));
            Assert.AreEqual(cred_card2_in_out_record.Description, (String)new_row.Read_cell(3));
            Assert.AreEqual(cred_card2_in_out_record.Reconciled_amount, (Double)new_row.Read_cell(4));

            // Clean up
            previous_record.Populate_spreadsheet_row(cells, last_row_number);
        }
Exemple #3
0
        public void Will_insert_null_in_relevant_cell_when_cred_card2_in_out_record_is_not_matched()
        {
            // Arrange
            var cred_card2_in_out_record = new CredCard2InOutRecord {
                Matched = false
            };
            var cells           = _spreadsheet.Current_cells("CredCard");
            var last_row_number = _spreadsheet.Last_row_number("CredCard");
            var previous_record = new CredCard2InOutRecord();

            previous_record.Read_from_spreadsheet_row(_spreadsheet.Read_last_row("CredCard"));

            // Act
            cred_card2_in_out_record.Populate_spreadsheet_row(cells, last_row_number);
            var new_row = _spreadsheet.Read_last_row("CredCard");

            // Assert
            Assert.AreEqual(null, (String)new_row.Read_cell(2));

            // Clean up
            previous_record.Populate_spreadsheet_row(cells, last_row_number);
        }
Exemple #4
0
        public void Will_insert_divider_text_in_second_cell_when_cred_card2_in_out_record_is_divider()
        {
            // Arrange
            var cred_card2_in_out_record = new CredCard2InOutRecord {
                Divider = true
            };
            var cells           = _spreadsheet.Current_cells("CredCard");
            var last_row_number = _spreadsheet.Last_row_number("CredCard");
            var previous_record = new CredCard2InOutRecord();

            previous_record.Read_from_spreadsheet_row(_spreadsheet.Read_last_row("CredCard"));

            // Act
            cred_card2_in_out_record.Populate_spreadsheet_row(cells, last_row_number);
            var new_row = _spreadsheet.Read_last_row("CredCard");

            // Assert
            Assert.AreEqual(ReconConsts.DividerText, (String)new_row.Read_cell(1));

            // Clean up
            previous_record.Populate_spreadsheet_row(cells, last_row_number);
        }
        public void M_WillAddMatchData_WhenPopulatingCredCard2SpreadsheetRow()
        {
            // Arrange
            var row = 10;
            var cred_card2_in_out_record = new CredCard2InOutRecord
            {
                Match = new CredCard2Record
                {
                    Date        = DateTime.Today,
                    Amount      = 22.34,
                    Description = "match description"
                }
            };
            var mock_cells = new Mock <ICellSet>();

            // Act
            cred_card2_in_out_record.Populate_spreadsheet_row(mock_cells.Object, row);

            // Assert
            mock_cells.Verify(x => x.Populate_cell(row, CredCard2Record.DateSpreadsheetIndex + 1, cred_card2_in_out_record.Match.Date), "Date");
            mock_cells.Verify(x => x.Populate_cell(row, CredCard2Record.AmountSpreadsheetIndex + 1, cred_card2_in_out_record.Match.Main_amount()), "Amount");
            mock_cells.Verify(x => x.Populate_cell(row, CredCard2Record.DescriptionSpreadsheetIndex + 1, cred_card2_in_out_record.Match.Description), "Desc");
        }