Пример #1
0
        public void M_CanAddNewTransactionToEndOfSavginsSheet()
        {
            // Arrange
            var      expected_sheet_name   = MainSheetNames.Savings;
            DateTime new_date              = new DateTime(2018, 11, 25);
            double   new_amount            = 32.45;
            var      mock_spreadsheet_repo = new Mock <ISpreadsheetRepo>();
            int      expected_row_number   = 49;
            int      first_column          = 1;

            mock_spreadsheet_repo.Setup(x => x.Find_first_empty_row_in_column(
                                            expected_sheet_name,
                                            first_column))
            .Returns(expected_row_number);
            var spreadsheet = new Spreadsheet(mock_spreadsheet_repo.Object);

            // Act
            spreadsheet.Add_new_transaction_to_savings(new_date, new_amount);

            // Assert
            mock_spreadsheet_repo.Verify(x => x.Update_date(
                                             expected_sheet_name,
                                             expected_row_number,
                                             first_column,
                                             new_date));
            mock_spreadsheet_repo.Verify(x => x.Update_amount(
                                             expected_sheet_name,
                                             expected_row_number,
                                             first_column + 1,
                                             new_amount));
        }