Beispiel #1
0
        public void Will_update_expected_income_record_when_matched()
        {
            // Arrange
            var match_desc     = "matchDesc";
            var match_date     = DateTime.Today.AddDays(2);
            var match_amount   = 22.22;
            var source_date    = DateTime.Today;
            var source_amount  = 22.22;
            var income_file_io = new Mock <IFileIO <ExpectedIncomeRecord> >();
            var income_records = new List <ExpectedIncomeRecord>
            {
                new ExpectedIncomeRecord
                {
                    Description         = match_desc,
                    Date                = match_date,
                    Unreconciled_amount = match_amount
                }
            };

            income_file_io.Setup(x => x.Load(It.IsAny <List <string> >(), null)).Returns(income_records);
            var income_file = new CSVFile <ExpectedIncomeRecord>(income_file_io.Object);

            income_file.Load();
            var expected_income_file = new ExpectedIncomeFile(income_file);
            var actual_bank_record   = new ActualBankRecord
            {
                Date   = source_date,
                Amount = source_amount
            };
            var bank_record = new BankRecord
            {
                Description         = match_desc,
                Date                = match_date,
                Unreconciled_amount = match_amount
            };

            // Act
            expected_income_file.Update_expected_income_record_when_matched(actual_bank_record, bank_record);

            // Assert
            Assert.AreEqual(match_desc, income_records[0].Description);
            Assert.AreEqual(match_amount, income_records[0].Unreconciled_amount);
            Assert.AreEqual(actual_bank_record, income_records[0].Match);
            Assert.AreEqual(true, income_records[0].Matched);
            Assert.AreEqual(match_date, income_records[0].Date);
            Assert.AreEqual(source_date, income_records[0].Date_paid);
            Assert.AreEqual(source_amount, income_records[0].Total_paid);
        }
 public void Update_expected_income_record_when_matched(ICSVRecord source_record, ICSVRecord matched_record)
 {
     _expected_income_file.Update_expected_income_record_when_matched(source_record, matched_record);
 }