コード例 #1
0
        public void CanSupportCategoryWithNoSubCategory()
        {
            var category = new BudgetCategory(BudgetType.Utilities);

            Assert.That(category.MainCategory, Is.EqualTo("Utilities"));
            Assert.That(category.SubCategory, Is.EqualTo(""));
        }
コード例 #2
0
ファイル: BudgetEntry.cs プロジェクト: durwood/Retire
 public BudgetEntry(double amount, string label, BudgetType budgetType)
 {
     Amount        = amount;
     this.Label    = label;
     BudgetType    = budgetType;
     this.Category = BudgetCategoryFactory.GetBudgetCategory(budgetType);
 }
コード例 #3
0
        public void CanCreateSimpleBudgetCategory()
        {
            var category = new BudgetCategory(BudgetType.Utilities_Gas);

            Assert.That(category.MainCategory, Is.EqualTo("Utilities"));
            Assert.That(category.SubCategory, Is.EqualTo("Gas"));
        }
コード例 #4
0
ファイル: Budget.cs プロジェクト: durwood/Retire
 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;
         }
     }
 }
コード例 #5
0
ファイル: Report.cs プロジェクト: durwood/Retire
        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);
        }
コード例 #6
0
ファイル: Report.cs プロジェクト: durwood/Retire
        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);
            }
        }
コード例 #7
0
 public void IsIncomeWorks()
 {
     Assert.That(BudgetCategory.IsIncome(BudgetType.Income_Misc), Is.True);
     Assert.That(BudgetCategory.IsIncome(BudgetType.Auto_Gas), Is.False);
 }
コード例 #8
0
ファイル: BudgetEntry.cs プロジェクト: durwood/Retire
 public BudgetEntryDto(BudgetEntry budgetEntry)
 {
     Amount   = budgetEntry.Amount;
     Label    = budgetEntry.Label;
     Category = budgetEntry.Category;
 }