private string Num_months_question(BudgetingMonths budgeting_months, string item)
        {
            var months = budgeting_months.Num_budgeting_months();
            var start  = budgeting_months.Budgeting_start_date().ToString("MMM", CultureInfo.CurrentCulture);
            var end    = budgeting_months.Budgeting_end_date().ToString("MMM", CultureInfo.CurrentCulture);

            return($"You're budgeting for {months} months, {start} til {end}. How many months of {item} do you want to budget for?");
        }
        private string Get_response_to_budgeting_months_confirmation_message(BudgetingMonths budgeting_months)
        {
            string first_month  = CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(budgeting_months.Next_unplanned_month);
            string second_month = CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(budgeting_months.Last_month_for_budget_planning);

            int month_span = budgeting_months.Num_budgeting_months();

            var confirmation_text = String.Format(ReconConsts.ConfirmMonthInterval, first_month, second_month, month_span);

            return(_input_output.Get_input(confirmation_text));
        }
Exemple #3
0
        public void Will_calculate_num_budgeting_months_based_on_stored_data(
            int next_unplanned_month,
            int last_month_for_budget_planning,
            int expected_result)
        {
            // Arrange
            var budgeting_months = new BudgetingMonths
            {
                Next_unplanned_month           = next_unplanned_month,
                Last_month_for_budget_planning = last_month_for_budget_planning
            };

            // Act
            var result = budgeting_months.Num_budgeting_months();

            // Assert
            Assert.AreEqual(expected_result, result);
        }
        public void Update_owed_CHB(BudgetingMonths budgeting_months)
        {
            var num_months     = budgeting_months.Num_budgeting_months();
            var base_amount    = _spreadsheet_io.Get_amount(MainSheetNames.Budget_out, Codes.Code003);
            var current_amount = _spreadsheet_io.Get_amount(MainSheetNames.Expected_out, Codes.Code003, 2);
            var new_amount     = current_amount + (base_amount * num_months);
            var total_months   = (current_amount / base_amount) + num_months;

            _spreadsheet_io.Update_amount(MainSheetNames.Expected_out, Codes.Code003, new_amount);

            var text = _spreadsheet_io.Get_text(MainSheetNames.Expected_out, Codes.Code003);

            if (!String.IsNullOrEmpty(text))
            {
                var begin_text  = text.Substring(0, text.Length - 31);
                var month_total = String.Format("{0:00}", total_months);
                var start_date  = text.Substring(text.Length - 21, 8);
                var end_month   = budgeting_months.Budgeting_end_date().ToString("MMM", CultureInfo.CurrentCulture);
                var end_year    = budgeting_months.Budgeting_end_date().Year;
                text = $"{begin_text}{month_total} months {start_date} to {end_month} {end_year})";
                _spreadsheet_io.Update_text(MainSheetNames.Expected_out, Codes.Code003, text);
            }
        }