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