public void M_WhenRemovingRecordPermanentlyItDoesNotComeBackAfterRefreshingFileContents() { // Arrange var mock_file_io = new Mock <IFileIO <ExpectedIncomeRecord> >(); var new_description = "Third record"; var source_records = new List <ExpectedIncomeRecord> { new ExpectedIncomeRecord { Description = "First record" }, new ExpectedIncomeRecord { Description = "Second record" } }; mock_file_io.Setup(x => x.Load(It.IsAny <List <string> >(), null)).Returns(source_records); var file = new CSVFile <ExpectedIncomeRecord>(mock_file_io.Object); file.Load(); Assert.AreEqual(2, file.Records.Count); // Act file.Add_record_permanently(new ExpectedIncomeRecord { Description = new_description }); file.Populate_records_from_original_file_load(); // Assert Assert.AreEqual(3, file.Records.Count); Assert.AreEqual(new_description, file.Records[2].Description); }
public void M_WhenAddingRecordPermanentlyItIsStillThereAfterRefreshingFileContents() { // Arrange var mock_file_io = new Mock <IFileIO <ExpectedIncomeRecord> >(); var lost_description = "First record"; var source_records = new List <ExpectedIncomeRecord> { new ExpectedIncomeRecord { Description = lost_description }, new ExpectedIncomeRecord { Description = "Second record" } }; mock_file_io.Setup(x => x.Load(It.IsAny <List <string> >(), null)).Returns(source_records); var file = new CSVFile <ExpectedIncomeRecord>(mock_file_io.Object); file.Load(); Assert.AreEqual(2, file.Records.Count); // Act file.Remove_record_permanently(source_records[0]); file.Populate_records_from_original_file_load(); // Assert Assert.AreEqual(1, file.Records.Count); Assert.IsFalse(file.Records.Any(x => x.Description == lost_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(); }