Esempio n. 1
0
 public double CalculateCurrentBudget(Budget budget)
 {
     return(budget.Amount - CalculateSavings(budget) - SumPastExpenses(budget));
 }
Esempio n. 2
0
 public double CalculateRemainingBudget(Budget budget)
 {
     return(CalculateCurrentBudget(budget) - CalculateTodaysAllowance(budget));
 }
Esempio n. 3
0
 public double SumPastExpenses(Budget budget)
 {
     return(GetPastExpenses(budget).Sum(expense => expense.Amount));
 }
Esempio n. 4
0
 public double SumTodaysExpenses(Budget budget)
 {
     return(GetTodaysExpenses(budget).Sum(expense => expense.Amount));
 }
Esempio n. 5
0
 public IEnumerable <Expense> GetTodaysExpenses(Budget budget)
 {
     return(budget.Expenses.Where(expense => expense.Date == _dateProvider.Today()));
 }
Esempio n. 6
0
 public bool IsTodayInBudgetScope(Budget budget)
 {
     return(_dateProvider.Today() >= budget.Start &&
            _dateProvider.Today() <= budget.End);
 }
Esempio n. 7
0
 public int GetNumberOfTotalDays(Budget budget)
 {
     return((int)(budget.End - budget.Start).TotalDays + 1);
 }
Esempio n. 8
0
 public int GetNumberOfRemainingDays(Budget budget)
 {
     return(_dateProvider.Today() < budget.End
         ? (int)(budget.End - _dateProvider.Today()).TotalDays
         : 0);
 }
Esempio n. 9
0
 public int GetNumberOfPastDays(Budget budget)
 {
     return(_dateProvider.Today() > budget.Start
         ? (int)(_dateProvider.Today() - budget.Start).TotalDays
         : 0);
 }