public void WhenFinishing_WillReconcileAllRecords() { // Arrange var mock_income_file_io = new Mock <IFileIO <ExpectedIncomeRecord> >(); var desc1 = "desc1"; var desc2 = "desc2"; var amount = 10; var expected_income_records = new List <ExpectedIncomeRecord> { new ExpectedIncomeRecord { Matched = false, Unreconciled_amount = amount, Reconciled_amount = 0, Description = desc1 }, new ExpectedIncomeRecord { Matched = true, Unreconciled_amount = amount, Reconciled_amount = 0, Description = desc2 } }; mock_income_file_io.Setup(x => x.Load(It.IsAny <List <string> >(), null)).Returns(expected_income_records); var csv_file = new CSVFile <ExpectedIncomeRecord>(mock_income_file_io.Object); csv_file.Load(); var expected_income_file = new ExpectedIncomeFile(csv_file); // Act expected_income_file.Finish(); // Assert Assert.AreEqual(amount, csv_file.Records[0].Unreconciled_amount); Assert.AreEqual(0, csv_file.Records[0].Reconciled_amount); Assert.AreEqual(desc1, csv_file.Records[0].Description); Assert.AreEqual(0, csv_file.Records[1].Unreconciled_amount); Assert.AreEqual(amount, csv_file.Records[1].Reconciled_amount); Assert.AreEqual(desc2, csv_file.Records[1].Description); }
public void WhenFinishing_WillWriteBackToMainSpreadsheet() { // Arrange var mock_expected_income_file = new Mock <ICSVFile <ExpectedIncomeRecord> >(); mock_expected_income_file.Setup(x => x.Records).Returns(new List <ExpectedIncomeRecord>()); var expected_income_file = new ExpectedIncomeFile(mock_expected_income_file.Object); // Act expected_income_file.Finish(); // Assert mock_expected_income_file.Verify(x => x.Write_back_to_main_spreadsheet(MainSheetNames.Expected_in)); }
public void Finish() { _expected_income_file.Finish(); }