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