Exemple #1
0
        public void Will_copy_all_records_to_pending_file()
        {
            // Arrange
            var mock_expected_income_file = new Mock <ICSVFile <ExpectedIncomeRecord> >();
            var expected_income_records   = new List <ExpectedIncomeRecord>
            {
                new ExpectedIncomeRecord
                {
                    Description = "description1"
                },
                new ExpectedIncomeRecord
                {
                    Description = "description2"
                }
            };

            mock_expected_income_file.Setup(x => x.Records).Returns(expected_income_records);
            var expected_income_file = new ExpectedIncomeFile(mock_expected_income_file.Object);
            var mock_pending_file_io = new Mock <IFileIO <BankRecord> >();

            mock_pending_file_io.Setup(x => x.Load(It.IsAny <List <string> >(), null)).Returns(new List <BankRecord>());
            var pending_file = new CSVFile <BankRecord>(mock_pending_file_io.Object);

            pending_file.Load();
            Assert.AreEqual(0, pending_file.Records.Count);

            // Act
            expected_income_file.Copy_to_pending_file(pending_file);

            // Assert
            Assert.AreEqual(2, pending_file.Records.Count);
            Assert.AreEqual(expected_income_file.File.Records[0].Description, pending_file.Records[0].Description);
            Assert.AreEqual(expected_income_file.File.Records[1].Description, pending_file.Records[1].Description);
        }
        public void Merge_bespoke_data_with_pending_file(
            IInputOutput input_output,
            ISpreadsheet spreadsheet,
            ICSVFile <BankRecord> pending_file,
            BudgetingMonths budgeting_months,
            DataLoadingInformation <ActualBankRecord, BankRecord> data_loading_info)
        {
            input_output.Output_line(ReconConsts.Loading_expenses);
            _expected_income_csv_file.Load(false);

            spreadsheet.Add_unreconciled_rows_to_csv_file <ExpectedIncomeRecord>(MainSheetNames.Expected_in, _expected_income_file.File);
            _expected_income_csv_file.Populate_source_records_from_records();
            _expected_income_file.Filter_for_employer_expenses_and_bank_transactions_only();

            _expected_income_file.Copy_to_pending_file(pending_file);
            _expected_income_csv_file.Populate_records_from_original_file_load();
        }