public void CanSupportCategoryWithNoSubCategory() { var category = new BudgetCategory(BudgetType.Utilities); Assert.That(category.MainCategory, Is.EqualTo("Utilities")); Assert.That(category.SubCategory, Is.EqualTo("")); }
public BudgetEntry(double amount, string label, BudgetType budgetType) { Amount = amount; this.Label = label; BudgetType = budgetType; this.Category = BudgetCategoryFactory.GetBudgetCategory(budgetType); }
public void CanCreateSimpleBudgetCategory() { var category = new BudgetCategory(BudgetType.Utilities_Gas); Assert.That(category.MainCategory, Is.EqualTo("Utilities")); Assert.That(category.SubCategory, Is.EqualTo("Gas")); }
public void AddEntry(BudgetEntry budgetEntry) { BudgetEntries.Add(budgetEntry); for (int ii = 1; ii <= 12; ++ii) { var monthlyEntry = budgetEntry.GetMonthEntry(ii); if (BudgetCategory.IsIncome(budgetEntry.BudgetType)) { _monthlyIncome[ii] += monthlyEntry; TotalIncome += monthlyEntry; } else { _monthlyExpenses[ii] += monthlyEntry; TotalExpenses += monthlyEntry; } } }
public Dictionary <string, double> GetReport(bool incomeDetails = true) { var report = new Dictionary <string, double>(); foreach (var kvp in Entries) { var amount = kvp.Value; var budgetCategory = new BudgetCategory(kvp.Key); if (budgetCategory.MainCategory == "Income" && incomeDetails) { UpdateReport(report, amount, budgetCategory.MainCategory, budgetCategory.SubCategory); } else { UpdateReport(report, amount, budgetCategory.MainCategory); } } return(report); }
internal void AddExpenditure(BudgetType type, double amount) { if (BudgetCategory.IsIncome(type)) { Income += amount; } else { Expenses += amount; } if (Entries.ContainsKey(type)) { Entries[type] += amount; } else { Entries.Add(type, amount); } }
public void IsIncomeWorks() { Assert.That(BudgetCategory.IsIncome(BudgetType.Income_Misc), Is.True); Assert.That(BudgetCategory.IsIncome(BudgetType.Auto_Gas), Is.False); }
public BudgetEntryDto(BudgetEntry budgetEntry) { Amount = budgetEntry.Amount; Label = budgetEntry.Label; Category = budgetEntry.Category; }